Sfoglia il codice sorgente

closure parameters in signature

Nicolas Cannasse 14 anni fa
parent
commit
7cf0d8bf56
2 ha cambiato i file con 5 aggiunte e 1 eliminazioni
  1. 2 0
      genneko.ml
  2. 3 1
      interp.ml

+ 2 - 0
genneko.ml

@@ -273,6 +273,8 @@ and gen_expr ctx e =
 		gen_binop ctx p op e1 e2
 	| TField (e,f) ->
 		field p (gen_expr ctx e) f
+	| TClosure (({ eexpr = TTypeExpr _ } as e),f) ->
+		field p (gen_expr ctx e) f
 	| TClosure (e2,f) ->
 		(match follow e.etype with
 		| TFun (args,_) ->

+ 3 - 1
interp.ml

@@ -1642,8 +1642,10 @@ let macro_lib =
 					cache := (v,v2) :: !cache;
 					v2
 				| VClosure (vl,f) ->
-					let v2 = VClosure ([], Obj.magic (List.length !cache)) in
+					let rl = ref [] in
+					let v2 = VClosure (Obj.magic rl, Obj.magic (List.length !cache)) in
 					cache := (v,v2) :: !cache;
+					rl := List.map loop vl;
 					v2
 				| VAbstract (AHash h) ->
 					let h2 = Hashtbl.create 0 in