Browse Source

adjust custom JS generators to typed AST changes (closes #2745)

Simon Krajewski 11 years ago
parent
commit
1d3f7f72d4
3 changed files with 8 additions and 11 deletions
  1. 2 0
      extra/CHANGES.txt
  2. 0 1
      interp.ml
  3. 6 10
      typer.ml

+ 2 - 0
extra/CHANGES.txt

@@ -7,9 +7,11 @@
 	all : removed @:to Dynamic from UInt to avoid issues in the Map selection algorithm
 	all : fixed various issues with member/static extension macros
 	all : disallowed member field initialization of classes without constructors
+	all : added -D deprecation-warnings
 	flash : fixed invalid override involving single-constraint type parameters
 	flash8: fixed various bugs
 	js : disable Std.string optimization of basic type to avoid problems with null values
+	js : fixed custom generators
 
 2014-03-04: 3.1.0
 

+ 0 - 1
interp.ml

@@ -59,7 +59,6 @@ and vabstract =
 	| AZipD of zlib
 	| AUtf8 of UTF8.Buf.buf
 	| ASocket of Unix.file_descr
-	| ATExpr of texpr
 	| ATDecl of module_type
 	| AUnsafe of Obj.t
 	| ALazyType of (unit -> Type.t) ref

+ 6 - 10
typer.ml

@@ -3849,11 +3849,9 @@ let make_macro_api ctx p =
 					"types", Interp.enc_array (List.map (fun t -> Interp.encode_type (make_instance t)) ctx.com.types);
 					"main", (match ctx.com.main with None -> Interp.VNull | Some e -> Interp.encode_texpr e);
 					"generateValue", Interp.VFunction (Interp.Fun1 (fun v ->
-						match v with
-						| Interp.VAbstract (Interp.ATExpr e) ->
-							let str = Genjs.gen_single_expr js_ctx e false in
-							Interp.enc_string str
-						| _ -> failwith "Invalid expression";
+						let e = Interp.decode_texpr v in
+						let str = Genjs.gen_single_expr js_ctx e false in
+						Interp.enc_string str
 					));
 					"isKeyword", Interp.VFunction (Interp.Fun1 (fun v ->
 						Interp.VBool (Hashtbl.mem Genjs.kwds (Interp.dec_string v))
@@ -3867,11 +3865,9 @@ let make_macro_api ctx p =
 						| Some e -> Interp.encode_texpr e
 					));
 					"generateStatement", Interp.VFunction (Interp.Fun1 (fun v ->
-						match v with
-						| Interp.VAbstract (Interp.ATExpr e) ->
-							let str = Genjs.gen_single_expr js_ctx e true in
-							Interp.enc_string str
-						| _ -> failwith "Invalid expression";
+						let e = Interp.decode_texpr v in
+						let str = Genjs.gen_single_expr js_ctx e true in
+						Interp.enc_string str
 					));
 					"setTypeAccessor", Interp.VFunction (Interp.Fun1 (fun callb ->
 						js_ctx.Genjs.type_accessor <- (fun t ->