Просмотр исходного кода

minor : added TFor variable type.

Nicolas Cannasse 18 лет назад
Родитель
Сommit
4a131f162d
5 измененных файлов с 8 добавлено и 8 удалено
  1. 1 1
      genjs.ml
  2. 2 2
      genneko.ml
  3. 1 1
      genswf8.ml
  4. 2 2
      transform.ml
  5. 2 2
      type.ml

+ 1 - 1
genjs.ml

@@ -316,7 +316,7 @@ and gen_expr ctx e =
 		spr ctx "{ ";
 		concat ctx ", " (fun (f,e) -> print ctx "%s : " f; gen_value ctx e) fields;
 		spr ctx "}"
-	| TFor (v,it,e) ->
+	| TFor (v,_,it,e) ->
 		let handle_break = handle_break ctx e in
 		let id = ctx.id_counter in
 		ctx.id_counter <- ctx.id_counter + 1;

+ 2 - 2
genneko.ml

@@ -70,7 +70,7 @@ let add_local ctx v p =
 		| TVars l ->
 			if List.exists (fun (a,_,_) -> a = v) l then raise Not_found;
 			Type.iter (loop flag) e
-		| TFor (a,e1,e2) ->
+		| TFor (a,_,e1,e2) ->
 			loop flag e1;
 			if a <> v then loop flag e2
 		| TMatch (e,_,cases,eo) ->
@@ -334,7 +334,7 @@ and gen_expr ctx e =
 		let e = (EBlock (loop el), p) in
 		b();
 		e
-	| TFor (v, it, e) ->
+	| TFor (v, _, it, e) ->
 		let it = gen_expr ctx it in
 		let b = block ctx [e] in
 		let isref = add_local ctx v p in

+ 1 - 1
genswf8.ml

@@ -989,7 +989,7 @@ and gen_expr_2 ctx retval e =
 		gen_unop ctx retval op flag e
 	| TMatch (e,_,cases,def) ->
 		gen_match ctx retval e cases def
-	| TFor (v,it,e) ->
+	| TFor (v,_,it,e) ->
 		gen_expr ctx true it;
 		let r = alloc_reg ctx in
 		write ctx (ASetReg r);

+ 2 - 2
transform.ml

@@ -31,8 +31,8 @@ let rec map f e =
 		{ e with eexpr = TArray (f e1,f e2) }
 	| TBinop (op,e1,e2) ->
 		{ e with eexpr = TBinop (op,f e1,f e2) }
-	| TFor (v,e1,e2) ->
-		{ e with eexpr = TFor (v,f e1,f e2) }
+	| TFor (v,t,e1,e2) ->
+		{ e with eexpr = TFor (v,t,f e1,f e2) }
 	| TWhile (e1,e2,flag) ->
 		{ e with eexpr = TWhile (f e1,f e2,flag) }
 	| TThrow e1 ->

+ 2 - 2
type.ml

@@ -82,7 +82,7 @@ and texpr_expr =
 	| TFunction of tfunc
 	| TVars of (string * t * texpr option) list
 	| TBlock of texpr list
-	| TFor of string * texpr * texpr
+	| TFor of string * t * texpr * texpr
 	| TIf of texpr * texpr * texpr option
 	| TWhile of texpr * texpr * Ast.while_flag
 	| TSwitch of texpr * (texpr list * texpr) list * texpr option
@@ -745,7 +745,7 @@ let rec iter f e =
 		()
 	| TArray (e1,e2)
 	| TBinop (_,e1,e2)
-	| TFor (_,e1,e2)
+	| TFor (_,_,e1,e2)
 	| TWhile (e1,e2,_) ->
 		f e1;
 		f e2;