Bläddra i källkod

rename TVars to TVar

Simon Krajewski 11 år sedan
förälder
incheckning
f8721534b1
21 ändrade filer med 151 tillägg och 151 borttagningar
  1. 7 7
      codegen.ml
  2. 1 1
      dce.ml
  3. 12 12
      filters.ml
  4. 2 2
      genas3.ml
  5. 52 52
      gencommon.ml
  6. 5 5
      gencpp.ml
  7. 9 9
      gencs.ml
  8. 5 5
      genjava.ml
  9. 2 2
      genjs.ml
  10. 1 1
      genneko.ml
  11. 2 2
      genphp.ml
  12. 1 1
      genswf.ml
  13. 1 1
      genswf8.ml
  14. 1 1
      genswf9.ml
  15. 3 3
      interp.ml
  16. 19 19
      optimizer.ml
  17. 1 1
      std/haxe/macro/Type.hx
  18. 2 2
      std/haxe/macro/TypedExprTools.hx
  19. 9 9
      type.ml
  20. 1 1
      typeload.ml
  21. 15 15
      typer.ml

+ 7 - 7
codegen.ml

@@ -788,7 +788,7 @@ module PatternMatchConversion = struct
 				else
 					((v,Some e) :: vl), el
 			) ([],[e]) bl in
-			let el_v = List.map (fun (v,eo) -> mk (TVars (v,eo)) cctx.ctx.t.tvoid e.epos) vl in
+			let el_v = List.map (fun (v,eo) -> mk (TVar (v,eo)) cctx.ctx.t.tvoid e.epos) vl in
 			mk (TBlock (el_v @ el)) e.etype e.epos
 		| DTGoto i ->
 			convert_dt cctx (cctx.dt_lookup.(i))
@@ -817,7 +817,7 @@ module PatternMatchConversion = struct
 		if dt.dt_var_init = [] then
 			e
 		else begin
-			let el_v = List.map (fun (v,eo) -> mk (TVars (v,eo)) cctx.ctx.t.tvoid p) dt.dt_var_init in
+			let el_v = List.map (fun (v,eo) -> mk (TVar (v,eo)) cctx.ctx.t.tvoid p) dt.dt_var_init in
 			mk (TBlock (el_v @ [e])) dt.dt_type e.epos
 		end
 end
@@ -934,7 +934,7 @@ let stack_context_init com stack_var exc_var pos_var tmp_var use_add p =
 	let stack_return e =
 		let tmp = alloc_var tmp_var e.etype in
 		mk (TBlock [
-			mk (TVars (tmp, Some e)) t.tvoid e.epos;
+			mk (TVar (tmp, Some e)) t.tvoid e.epos;
 			stack_pop;
 			mk (TReturn (Some (mk (TLocal tmp) e.etype e.epos))) e.etype e.epos
 		]) e.etype e.epos
@@ -946,7 +946,7 @@ let stack_context_init com stack_var exc_var pos_var tmp_var use_add p =
 		stack_pos = p;
 		stack_expr = stack_e;
 		stack_pop = stack_pop;
-		stack_save_pos = mk (TVars (pos_var, Some (field stack_e "length" t.tint p))) t.tvoid p;
+		stack_save_pos = mk (TVar (pos_var, Some (field stack_e "length" t.tint p))) t.tvoid p;
 		stack_push = stack_push;
 		stack_return = stack_return;
 		stack_restore = [
@@ -1059,7 +1059,7 @@ let fix_override com c f fd =
 						let el = (match e.eexpr with TBlock el -> el | _ -> [e]) in
 						let p = (match el with [] -> e.epos | e :: _ -> e.epos) in
 						let el_v = List.map (fun (v,v2) ->
-							mk (TVars (v,Some (mk (TCast (mk (TLocal v2) v2.v_type p,None)) v.v_type p))) com.basic.tvoid p
+							mk (TVar (v,Some (mk (TCast (mk (TLocal v2) v2.v_type p,None)) v.v_type p))) com.basic.tvoid p
 						) args in
 						{ e with eexpr = TBlock (el_v @ el) }
 				);
@@ -1157,7 +1157,7 @@ let rec constructor_side_effects e =
 		false
 	| TUnop _ | TArray _ | TField _ | TEnumParameter _ | TCall _ | TNew _ | TFor _ | TWhile _ | TSwitch _ | TPatMatch _ | TReturn _ | TThrow _ ->
 		true
-	| TBinop _ | TTry _ | TIf _ | TBlock _ | TVars _
+	| TBinop _ | TTry _ | TIf _ | TBlock _ | TVar _
 	| TFunction _ | TArrayDecl _ | TObjectDecl _
 	| TParenthesis _ | TTypeExpr _ | TLocal _ | TMeta _
 	| TConst _ | TContinue | TBreak | TCast _ ->
@@ -1265,7 +1265,7 @@ let default_cast ?(vtmp="$t") com e texpr t p =
 		| TTypeDecl _ -> assert false
 	in
 	let vtmp = alloc_var vtmp e.etype in
-	let var = mk (TVars (vtmp,Some e)) api.tvoid p in
+	let var = mk (TVar (vtmp,Some e)) api.tvoid p in
 	let vexpr = mk (TLocal vtmp) e.etype p in
 	let texpr = mk (TTypeExpr texpr) (mk_texpr texpr) p in
 	let std = (try List.find (fun t -> t_path t = ([],"Std")) com.types with Not_found -> assert false) in

+ 1 - 1
dce.ml

@@ -292,7 +292,7 @@ and expr dce e =
 		field dce c "new" false;
 		List.iter (expr dce) el;
 		List.iter (mark_t dce e.epos) pl;
-	| TVars (v,e1) ->
+	| TVar (v,e1) ->
 		opt (expr dce) e1;
 		mark_t dce e.epos v.v_type;
 	| TCast(e, Some mt) ->

+ 12 - 12
filters.ml

@@ -35,7 +35,7 @@ let mk_block_context com gen_temp =
 	let push e = block_el := e :: !block_el in
 	let declare_temp t eo p =
 		let v = gen_temp t in
-		let e = mk (TVars (v,eo)) com.basic.tvoid p in
+		let e = mk (TVar (v,eo)) com.basic.tvoid p in
 		push e;
 		mk (TLocal v) t p
 	in
@@ -189,15 +189,15 @@ let promote_complex_rhs ctx e =
 		let r = ref [] in
 		List.iter (fun e ->
 			match e.eexpr with
-			| TVars(v,eo) ->
+			| TVar(v,eo) ->
 				begin match eo with
 					| Some e when is_complex e ->
 						r := (loop (fun e -> mk (TBinop(OpAssign,mk (TLocal v) v.v_type e.epos,e)) v.v_type e.epos) e)
-							:: ((mk (TVars (v,None)) ctx.basic.tvoid e.epos))
+							:: ((mk (TVar (v,None)) ctx.basic.tvoid e.epos))
 							:: !r
 					| Some e ->
-						r := (mk (TVars (v,Some (find e))) ctx.basic.tvoid e.epos) :: !r
-					| None -> r := (mk (TVars (v,None)) ctx.basic.tvoid e.epos) :: !r
+						r := (mk (TVar (v,Some (find e))) ctx.basic.tvoid e.epos) :: !r
+					| None -> r := (mk (TVar (v,None)) ctx.basic.tvoid e.epos) :: !r
 				end
 			| _ -> r := (find e) :: !r
 		) el;
@@ -272,7 +272,7 @@ let check_local_vars_init e =
 				if v.v_name = "this" then error "Missing this = value" e.epos
 				else error ("Local variable " ^ v.v_name ^ " used without being initialized") e.epos
 			end
-		| TVars (v,eo) ->
+		| TVar (v,eo) ->
 			begin
 				match eo with
 				| None ->
@@ -410,7 +410,7 @@ let rec local_usage f e =
 	match e.eexpr with
 	| TLocal v ->
 		f (Use v)
-	| TVars (v,eo) ->
+	| TVar (v,eo) ->
 		(match eo with None -> () | Some e -> local_usage f e);
 		f (Declare v);
 	| TFunction tf ->
@@ -474,7 +474,7 @@ let captured_vars com e =
 	let t = com.basic in
 
 	let rec mk_init av v pos =
-		mk (TVars (av,Some (mk (TArrayDecl [mk (TLocal v) v.v_type pos]) av.v_type pos))) t.tvoid pos
+		mk (TVar (av,Some (mk (TArrayDecl [mk (TLocal v) v.v_type pos]) av.v_type pos))) t.tvoid pos
 
 	and mk_var v used =
 		let v2 = alloc_var v.v_name (PMap.find v.v_id used) in
@@ -483,14 +483,14 @@ let captured_vars com e =
 
 	and wrap used e =
 		match e.eexpr with
-		| TVars (v,ve) ->
+		| TVar (v,ve) ->
 			let v,ve =
 				if PMap.mem v.v_id used then
 					v, Some (mk (TArrayDecl (match ve with None -> [] | Some e -> [wrap used e])) v.v_type e.epos)
 				else
 					v, (match ve with None -> None | Some e -> Some (wrap used e))
 			 in
-			{ e with eexpr = TVars (v,ve) }
+			{ e with eexpr = TVar (v,ve) }
 		| TLocal v when PMap.mem v.v_id used ->
 			mk (TArray ({ e with etype = v.v_type },mk (TConst (TInt 0l)) t.tint e.epos)) e.etype e.epos
 		| TFor (v,it,expr) when PMap.mem v.v_id used ->
@@ -731,7 +731,7 @@ let rename_local_vars com e =
 	in
 	let rec loop e =
 		match e.eexpr with
-		| TVars (v,eo) ->
+		| TVar (v,eo) ->
 			if not cfg.pf_locals_scope then declare v e.epos;
 			(match eo with None -> () | Some e -> loop e);
 			if cfg.pf_locals_scope then declare v e.epos;
@@ -970,7 +970,7 @@ let add_field_inits ctx t =
 					end else
 						eassign;
 			) inits in
-			let el = if !need_this then (mk (TVars((v, Some ethis))) ethis.etype ethis.epos) :: el else el in
+			let el = if !need_this then (mk (TVar((v, Some ethis))) ethis.etype ethis.epos) :: el else el in
 			match c.cl_constructor with
 			| None ->
 				let ct = TFun([],ctx.com.basic.tvoid) in

+ 2 - 2
genas3.ml

@@ -648,7 +648,7 @@ and gen_expr ctx e =
 	| TThrow e ->
 		spr ctx "throw ";
 		gen_value ctx e;
-	| TVars (v,eo) ->
+	| TVar (v,eo) ->
 		spr ctx "var ";
 		print ctx "%s : %s" (s_ident v.v_name) (type_str ctx v.v_type e.epos);
 		begin match eo with
@@ -844,7 +844,7 @@ and gen_value ctx e =
 	| TBreak
 	| TContinue ->
 		unsupported e.epos
-	| TVars _
+	| TVar _
 	| TFor _
 	| TWhile _
 	| TThrow _ ->

+ 52 - 52
gencommon.ml

@@ -109,7 +109,7 @@ struct
 
   let mk_heexpr = function
     | TConst _ -> 0 | TLocal _ -> 1 | TArray _ -> 3 | TBinop _ -> 4 | TField _ -> 5 | TTypeExpr _ -> 7 | TParenthesis _ -> 8 | TObjectDecl _ -> 9
-    | TArrayDecl _ -> 10 | TCall _ -> 11 | TNew _ -> 12 | TUnop _ -> 13 | TFunction _ -> 14 | TVars _ -> 15 | TBlock _ -> 16 | TFor _ -> 17 | TIf _ -> 18 | TWhile _ -> 19
+    | TArrayDecl _ -> 10 | TCall _ -> 11 | TNew _ -> 12 | TUnop _ -> 13 | TFunction _ -> 14 | TVar _ -> 15 | TBlock _ -> 16 | TFor _ -> 17 | TIf _ -> 18 | TWhile _ -> 19
     | TSwitch _ -> 20 | TPatMatch _ -> 21 | TTry _ -> 22 | TReturn _ -> 23 | TBreak -> 24 | TContinue -> 25 | TThrow _ -> 26 | TCast _ -> 27 | TMeta _ -> 28 | TEnumParameter _ -> 29
 
   let mk_heetype = function
@@ -1095,7 +1095,7 @@ let ensure_local gen block name e =
     | TLocal _ -> e
     | _ ->
       let var = mk_temp gen name e.etype in
-      block := { e with eexpr = TVars([ var, Some e ]); etype = gen.gcon.basic.tvoid; } :: !block;
+      block := { e with eexpr = TVar([ var, Some e ]); etype = gen.gcon.basic.tvoid; } :: !block;
       { e with eexpr = TLocal var }
 
 let reset_temps () = tmp_count := 0
@@ -1912,7 +1912,7 @@ struct
               let local = mk_local v e.epos in
               (match !add_expr with
                 | None ->
-                  add_expr := Some { e with eexpr = TVars([v, Some this]) }
+                  add_expr := Some { e with eexpr = TVar([v, Some this]) }
                 | Some _ -> ());
               local
             | TConst TSuper -> assert false
@@ -2138,11 +2138,11 @@ struct
                 let eleft, rest = match e1.eexpr with
                   | TField(ef, f) ->
                     let v = mk_temp gen "dynop" ef.etype in
-                    { e1 with eexpr = TField(mk_local v ef.epos, f) }, [ { eexpr = TVars([v,Some (run ef)]); etype = basic.tvoid; epos = ef.epos } ]
+                    { e1 with eexpr = TField(mk_local v ef.epos, f) }, [ { eexpr = TVar([v,Some (run ef)]); etype = basic.tvoid; epos = ef.epos } ]
                   | TArray(e1a, e2a) ->
                     let v = mk_temp gen "dynop" e1a.etype in
                     let v2 = mk_temp gen "dynopi" e2a.etype in
-                    { e1 with eexpr = TArray(mk_local v e1a.epos, mk_local v2 e2a.epos) }, [ { eexpr = TVars([v,Some (run e1a); v2, Some (run e2a)]); etype = basic.tvoid; epos = e1.epos } ]
+                    { e1 with eexpr = TArray(mk_local v e1a.epos, mk_local v2 e2a.epos) }, [ { eexpr = TVar([v,Some (run e1a); v2, Some (run e2a)]); etype = basic.tvoid; epos = e1.epos } ]
                   | _ -> assert false
                 in
                 { e with
@@ -2205,7 +2205,7 @@ struct
               | Prefix ->
                 let tvars = match tvars with
                   | [] -> []
-                  | _ -> [{ eexpr = TVars(tvars); etype = gen.gcon.basic.tvoid; epos = e.epos }]
+                  | _ -> [{ eexpr = TVar(tvars); etype = gen.gcon.basic.tvoid; epos = e.epos }]
                 in
                 let block = tvars @
                 [
@@ -2214,7 +2214,7 @@ struct
                 { eexpr = TBlock(block); etype = etype; epos = e.epos }
               | Postfix ->
                 let ret = mk_temp gen "ret" etype in
-                let tvars = { eexpr = TVars(tvars @ [ret, Some (mk_cast etype getvar)]); etype = gen.gcon.basic.tvoid; epos = e.epos } in
+                let tvars = { eexpr = TVar(tvars @ [ret, Some (mk_cast etype getvar)]); etype = gen.gcon.basic.tvoid; epos = e.epos } in
                 let retlocal = { eexpr = TLocal(ret); etype = etype; epos = e.epos } in
                 let block = tvars ::
                 [
@@ -2513,7 +2513,7 @@ struct
             let val_local = { earray with eexpr = TLocal(val_v) } in
             let ret_local = { earray with eexpr = TLocal(ret_v) } in
             (* var idx = 1; var val = x._get(idx); var ret = val++; x._set(idx, val); ret; *)
-            block := { eexpr = TVars(
+            block := { eexpr = TVar(
                 [
                   val_v, Some(mk_get earray arr_local idx_local); (* var val = x._get(idx) *)
                   ret_v, Some { e with eexpr = TUnop(op, flag, val_local) } (* var ret = val++ *)
@@ -2608,7 +2608,7 @@ struct
                   | None -> *) mk_temp gen "catchall" t_dynamic
                   (*| Some (v,_) -> v*)
                 in
-                let catchall_decl = { eexpr = TVars([catchall_var, Some(temp_local)]); etype=gen.gcon.basic.tvoid; epos = pos } in
+                let catchall_decl = { eexpr = TVar([catchall_var, Some(temp_local)]); etype=gen.gcon.basic.tvoid; epos = pos } in
                 let catchall_local = { eexpr = TLocal(catchall_var); etype = t_dynamic; epos = pos } in
                 (* if it is of type wrapper_type, unwrap it *)
                 let std_is = mk_static_field_access (get_cl (get_type gen ([],"Std"))) "is" (TFun(["v",false,t_dynamic;"cl",false,mt_to_t (get_type gen ([], "Class")) [t_dynamic]],gen.gcon.basic.tbool)) pos in
@@ -2620,13 +2620,13 @@ struct
                 let rec loop must_wrap_catches = match must_wrap_catches with
                   | (vcatch,catch) :: tl ->
                     { eexpr = TIf(mk_std_is vcatch.v_type catch.epos,
-                      { eexpr = TBlock({ eexpr=TVars([vcatch, Some(mk_cast vcatch.v_type catchall_local)]); etype=gen.gcon.basic.tvoid; epos=catch.epos } :: [catch] ); etype = catch.etype; epos = catch.epos },
+                      { eexpr = TBlock({ eexpr=TVar([vcatch, Some(mk_cast vcatch.v_type catchall_local)]); etype=gen.gcon.basic.tvoid; epos=catch.epos } :: [catch] ); etype = catch.etype; epos = catch.epos },
                       Some (loop tl));
                     etype = catch.etype; epos = catch.epos }
                   | [] ->
                     match catchall with
                       | Some (v,s) ->
-                        Codegen.concat { eexpr = TVars([v, Some(catchall_local)]); etype = gen.gcon.basic.tvoid; epos = pos } s
+                        Codegen.concat { eexpr = TVar([v, Some(catchall_local)]); etype = gen.gcon.basic.tvoid; epos = pos } s
                       | None ->
                         mk_block (rethrow_expr temp_local)
                 in
@@ -2751,7 +2751,7 @@ struct
     let rec run e =
       match e.eexpr with
 				(* parameterized functions handling *)
-				| TVars( vars ) -> (match tparam_anon_decl with
+				| TVar( vars ) -> (match tparam_anon_decl with
 					| None -> Type.map_expr run e
 					| Some tparam_anon_decl ->
 						let vars = List.filter (function
@@ -2763,7 +2763,7 @@ struct
 						in
 						match vars with
 						| [] -> { e with eexpr = TBlock([]) }
-						| _ -> Type.map_expr run { e with eexpr = TVars(vars) })
+						| _ -> Type.map_expr run { e with eexpr = TVar(vars) })
 				| TLocal ({ v_extra = Some( _ :: _, _) } as v)
 				| TArray ({ eexpr = TLocal ({ v_extra = Some( _ :: _, _) } as v) }, _) -> (* captured transformation *)
 					(match tparam_anon_acc with
@@ -2873,7 +2873,7 @@ struct
           List.iter (fun (v,_) -> check_params v.v_type; Hashtbl.add ignored v.v_id v) tf.tf_args;
           check_params tf.tf_type;
           Type.iter traverse expr
-        | TVars (vars) ->
+        | TVar (vars) ->
           List.iter (fun (v, opt) ->
 						(match v.v_extra with
 						| Some(_ :: _, _) -> ()
@@ -3224,7 +3224,7 @@ struct
           snd (List.fold_left (fun (count,acc) (v,const) ->
             (count + 1,
               {
-                eexpr = TVars([v, Some(mk_const const ( mk_varray count ) v.v_type)]);
+                eexpr = TVar([v, Some(mk_const const ( mk_varray count ) v.v_type)]);
                 etype = basic.tvoid;
                 epos = pos;
               } :: acc)
@@ -3241,7 +3241,7 @@ struct
             match args, fargs, dargs with
               | [], [], [] -> acc
               | (v,const) :: args, (vf,_) :: fargs, (vd,_) :: dargs ->
-                let acc = { eexpr = TVars([ v, Some(
+                let acc = { eexpr = TVar([ v, Some(
                   {
                     eexpr = TIf(
                       { eexpr = TBinop(Ast.OpEq, mk_local vd pos, undefined pos); etype = basic.tbool; epos = pos },
@@ -4217,7 +4217,7 @@ struct
                   epos = pos;
                 };
                 (* var new_me = /*special create empty with tparams construct*/ *)
-                { eexpr = TVars([new_me_var, Some(
+                { eexpr = TVar([new_me_var, Some(
                   gen.gtools.rf_create_empty cl params pos
                 )]); etype = gen.gcon.basic.tvoid; epos = pos };
                 { eexpr = TFor( (* for (field in Reflect.fields(this)) *)
@@ -4574,7 +4574,7 @@ struct
 
     helpers:
       try_call_unwrap_statement: (returns texpr option)
-        if underlying statement is TBinop(OpAssign/OpAssignOp), or TVars, with the right side being a Statement or a short circuit op, we can call apply_assign.
+        if underlying statement is TBinop(OpAssign/OpAssignOp), or TVar, with the right side being a Statement or a short circuit op, we can call apply_assign.
 
       apply_assign:
         if is TVar, first declare the tvar with default expression = null;
@@ -4615,7 +4615,7 @@ struct
 
       add_assign:
         see if the type is void. If it is, just add_statement the expression argument, and return a null value
-        else create a new variable, set TVars with Some() with the expression argument, add TVar with add_statement, and return the TLocal of this expression.
+        else create a new variable, set TVar with Some() with the expression argument, add TVar with add_statement, and return the TLocal of this expression.
 
       map_problematic_expr:
         call expr_stat_map on statement with problematic_expression_unwrap
@@ -4663,8 +4663,8 @@ struct
         { expr with eexpr = TCall(fn left_e, List.map fn params) }
       | TNew(cl, tparams, params) ->
         { expr with eexpr = TNew(cl, tparams, List.map fn params) }
-      | TVars(vars) ->
-        { expr with eexpr = TVars( List.map (fun (v,eopt) -> (v, Option.map fn eopt)) vars ) }
+      | TVar(vars) ->
+        { expr with eexpr = TVar( List.map (fun (v,eopt) -> (v, Option.map fn eopt)) vars ) }
       | TFor (v,cond,block) ->
         { expr with eexpr = TFor(v, fn cond, block) }
       | TIf(cond,eif,eelse) ->
@@ -4738,7 +4738,7 @@ struct
       | TParenthesis p | TMeta(_,p) -> shallow_expr_type p
       | TBlock ([e]) -> shallow_expr_type e
       | TCall _
-      | TVars _
+      | TVar _
       | TBlock _
       | TFor _
       | TWhile _
@@ -4856,7 +4856,7 @@ struct
         null expr.etype expr.epos
       | _ ->
         let var = mk_temp gen "stmt" expr.etype in
-        let tvars = { expr with eexpr = TVars([var,Some(expr)]) } in
+        let tvars = { expr with eexpr = TVar([var,Some(expr)]) } in
         let local = { expr with eexpr = TLocal(var) } in
         add_statement tvars;
         local
@@ -4899,7 +4899,7 @@ struct
       match expr.eexpr with
         | TBinop ( (Ast.OpBoolAnd as op), left, right) ->
           let var = mk_temp gen "boolv" right.etype in
-          let tvars = { right with eexpr = TVars([var, Some( { right with eexpr = TConst(TBool false); etype = gen.gcon.basic.tbool } )]); etype = gen.gcon.basic.tvoid } in
+          let tvars = { right with eexpr = TVar([var, Some( { right with eexpr = TConst(TBool false); etype = gen.gcon.basic.tbool } )]); etype = gen.gcon.basic.tvoid } in
           let local = { right with eexpr = TLocal(var) } in
 
           let mapped_left, ret_acc = loop ( (local, { right with eexpr = TBinop(Ast.OpAssign, local, right) } ) :: acc) left in
@@ -4914,7 +4914,7 @@ struct
           in
 
           let var = mk_temp gen "boolv" right.etype in
-          let tvars = { right with eexpr = TVars([var, Some( { right with eexpr = TConst(TBool false); etype = gen.gcon.basic.tbool } )]); etype = gen.gcon.basic.tvoid } in
+          let tvars = { right with eexpr = TVar([var, Some( { right with eexpr = TConst(TBool false); etype = gen.gcon.basic.tbool } )]); etype = gen.gcon.basic.tvoid } in
           let local = { right with eexpr = TLocal(var) } in
           add_statement tvars;
 
@@ -4922,7 +4922,7 @@ struct
         | _ when acc = [] -> assert false
         | _ ->
           let var = mk_temp gen "boolv" expr.etype in
-          let tvars = { expr with eexpr = TVars([var, Some( { expr with etype = gen.gcon.basic.tbool } )]); etype = gen.gcon.basic.tvoid } in
+          let tvars = { expr with eexpr = TVar([var, Some( { expr with etype = gen.gcon.basic.tbool } )]); etype = gen.gcon.basic.tvoid } in
           let local = { expr with eexpr = TLocal(var) } in
 
           let last_local = ref local in
@@ -4964,7 +4964,7 @@ struct
         | TBinop ( (Ast.OpBoolAnd as op), left, right)
         | TBinop ( (Ast.OpBoolOr as op), left, right) ->
           let var = mk_temp gen "boolv" left.etype in
-          let tvars = { left with eexpr = TVars([var, if is_first then Some(left) else Some( { left with eexpr = TConst(TBool false) } )]); etype = gen.gcon.basic.tvoid } in
+          let tvars = { left with eexpr = TVar([var, if is_first then Some(left) else Some( { left with eexpr = TConst(TBool false) } )]); etype = gen.gcon.basic.tvoid } in
           let local = { left with eexpr = TLocal(var) } in
           if not is_first then begin
             last_block := !last_block @ [ { left with eexpr = TBinop(Ast.OpAssign, local, left) } ]
@@ -4981,7 +4981,7 @@ struct
         | _ when is_first -> assert false
         | _ ->
           let var = mk_temp gen "boolv" expr.etype in
-          let tvars = { expr with eexpr = TVars([var, Some ( { expr with eexpr = TConst(TBool false) } ) ]); etype = gen.gcon.basic.tvoid } in
+          let tvars = { expr with eexpr = TVar([var, Some ( { expr with eexpr = TConst(TBool false) } ) ]); etype = gen.gcon.basic.tvoid } in
           let local = { expr with eexpr = TLocal(var) } in
           last_block := !last_block @ [ { expr with eexpr = TBinop(Ast.OpAssign, local, expr) } ];
           add_statement tvars;
@@ -5060,19 +5060,19 @@ struct
       | TBinop((Ast.OpAssignOp _ as op),left,({ eexpr = TBinop(Ast.OpBoolOr,_,_) } as right) ) ->
         let right = short_circuit_op_unwrap gen add_statement right in
         Some { expr with eexpr = TBinop(op, check_left left, right) }
-      | TVars([v,Some({ eexpr = TBinop(Ast.OpBoolAnd,_,_) } as right)])
-      | TVars([v,Some({ eexpr = TBinop(Ast.OpBoolOr,_,_) } as right)]) ->
+      | TVar([v,Some({ eexpr = TBinop(Ast.OpBoolAnd,_,_) } as right)])
+      | TVar([v,Some({ eexpr = TBinop(Ast.OpBoolOr,_,_) } as right)]) ->
         let right = short_circuit_op_unwrap gen add_statement right in
-        Some { expr with eexpr = TVars([v, Some(right)]) }
-      | TVars([v,Some(right)]) when shallow_expr_type right = Statement ->
-        add_statement ({ expr with eexpr = TVars([v, Some(null right.etype right.epos)]) });
+        Some { expr with eexpr = TVar([v, Some(right)]) }
+      | TVar([v,Some(right)]) when shallow_expr_type right = Statement ->
+        add_statement ({ expr with eexpr = TVar([v, Some(null right.etype right.epos)]) });
         handle_assign Ast.OpAssign { expr with eexpr = TLocal(v); etype = v.v_type } right
       (* TIf handling *)
       | TBinop((Ast.OpAssign as op),left, ({ eexpr = TIf _ } as right))
       | TBinop((Ast.OpAssignOp _ as op),left,({ eexpr = TIf _ } as right)) when is_problematic_if right ->
         handle_assign op left right
-      | TVars([v,Some({ eexpr = TIf _ } as right)]) when is_problematic_if right ->
-        add_statement ({ expr with eexpr = TVars([v, Some(null right.etype right.epos)]) });
+      | TVar([v,Some({ eexpr = TIf _ } as right)]) when is_problematic_if right ->
+        add_statement ({ expr with eexpr = TVar([v, Some(null right.etype right.epos)]) });
         handle_assign Ast.OpAssign { expr with eexpr = TLocal(v); etype = v.v_type } right
       | TWhile(cond, e1, flag) when is_problematic_if cond ->
         twhile_with_condition_statement gen add_statement expr cond e1 flag;
@@ -5126,8 +5126,8 @@ struct
           let rec process_statement e =
             let e = no_paren e in
             match e.eexpr, shallow_expr_type e with
-              | TVars( (hd1 :: hd2 :: _) as vars ), _ ->
-                List.iter (fun v -> process_statement { e with eexpr = TVars([v]) }) vars
+              | TVar( (hd1 :: hd2 :: _) as vars ), _ ->
+                List.iter (fun v -> process_statement { e with eexpr = TVar([v]) }) vars
               | TCall( { eexpr = TLocal v } as elocal, elist ), _ when String.get v.v_name 0 = '_' && Hashtbl.mem gen.gspecial_vars v.v_name ->
                 new_block := { e with eexpr = TCall( elocal, List.map (fun e ->
                   match e.eexpr with
@@ -6072,8 +6072,8 @@ struct
                   handle (e) (gen.greal_type e.etype) (gen.greal_type real_t)
               )
             | _ -> Type.map_expr run e)
-        | TVars (veopt_l) ->
-          { e with eexpr = TVars (List.map (fun (v,eopt) ->
+        | TVar (veopt_l) ->
+          { e with eexpr = TVar (List.map (fun (v,eopt) ->
             match eopt with
               | None -> (v,eopt)
               | Some e ->
@@ -6532,7 +6532,7 @@ struct
         *)
         let block =
         [
-          { eexpr = TVars([res, Some(ctx.rcf_hash_function hash_local fst_hash)]); etype = basic.tvoid; epos = pos };
+          { eexpr = TVar([res, Some(ctx.rcf_hash_function hash_local fst_hash)]); etype = basic.tvoid; epos = pos };
           { eexpr = TIf(gte, mk_return (mk_tarray fst_dynamics res_local), Some({
             eexpr = TBlock(
             [
@@ -6589,12 +6589,12 @@ struct
 
         let block =
         [
-          { eexpr = TVars([res, Some(ctx.rcf_hash_function hash_local fst_hash)]); etype = basic.tvoid; epos = pos };
+          { eexpr = TVar([res, Some(ctx.rcf_hash_function hash_local fst_hash)]); etype = basic.tvoid; epos = pos };
           {
             eexpr = TIf(gte,
               mk_return { eexpr = TBinop(Ast.OpAssign, mk_tarray fst_dynamics res_local, value_local); etype = value_local.etype; epos = pos },
               Some({ eexpr = TBlock([
-                { eexpr = TVars([ res2, Some(ctx.rcf_hash_function hash_local snd_hash)]); etype = basic.tvoid; epos = pos };
+                { eexpr = TVar([ res2, Some(ctx.rcf_hash_function hash_local snd_hash)]); etype = basic.tvoid; epos = pos };
                 {
                   eexpr = TIf(gte, { eexpr = TBlock([
                     mk_splice snd_hash res2_local;
@@ -6667,7 +6667,7 @@ struct
         return false;
       *)
       [
-        { eexpr = TVars([res,Some(ctx.rcf_hash_function local_switch_var hx_hashes)]); etype = basic.tvoid; epos = pos };
+        { eexpr = TVar([res,Some(ctx.rcf_hash_function local_switch_var hx_hashes)]); etype = basic.tvoid; epos = pos };
         {
           eexpr = TIf(gte, { eexpr = TBlock([
             mk_splice hx_hashes res_local;
@@ -6835,7 +6835,7 @@ struct
             change_exprs tl ((name,expr) :: acc)
           else begin
             let var = mk_temp gen "odecl" expr.etype in
-            exprs_before := { eexpr = TVars([var,Some expr]); etype = basic.tvoid; epos = expr.epos } :: !exprs_before;
+            exprs_before := { eexpr = TVar([var,Some expr]); etype = basic.tvoid; epos = expr.epos } :: !exprs_before;
             change_exprs tl ((name,mk_local var expr.epos) :: acc)
           end
         | [] -> acc
@@ -8637,7 +8637,7 @@ struct
           [], cond
         | _ ->
           let v = mk_temp gen "cond" cond.etype in
-          [ { eexpr = TVars([v, Some cond]); etype = gen.gcon.basic.tvoid; epos = cond.epos } ], mk_local v cond.epos
+          [ { eexpr = TVar([v, Some cond]); etype = gen.gcon.basic.tvoid; epos = cond.epos } ], mk_local v cond.epos
       in
       exprs_before, new_cond
 
@@ -8663,7 +8663,7 @@ struct
         | [] ->
             []
         | _ ->
-            [ { eexpr = TVars(tvars); etype = gen.gcon.basic.tvoid; epos = cond_local.epos } ]
+            [ { eexpr = TVar(tvars); etype = gen.gcon.basic.tvoid; epos = cond_local.epos } ]
 
     let traverse gen t opt_get_native_enum_tag =
       let rec run e =
@@ -8883,12 +8883,12 @@ struct
             let temp = mk_temp gen "iterator" in_expr.etype in
             let block =
             [
-              { eexpr = TVars([temp, Some(in_expr)]); etype = basic.tvoid; epos = in_expr.epos };
+              { eexpr = TVar([temp, Some(in_expr)]); etype = basic.tvoid; epos = in_expr.epos };
               {
                 eexpr = TWhile(
                   { eexpr = TCall(mk_access gen temp "hasNext" in_expr.epos, []); etype = basic.tbool; epos = in_expr.epos },
                   Codegen.concat ({
-                    eexpr = TVars([var, Some({ eexpr = TCall(mk_access gen temp "next" in_expr.epos, []); etype = var.v_type; epos = in_expr.epos })]);
+                    eexpr = TVar([var, Some({ eexpr = TCall(mk_access gen temp "next" in_expr.epos, []); etype = var.v_type; epos = in_expr.epos })]);
                     etype = basic.tvoid;
                     epos = in_expr.epos
                   }) ( run block ),
@@ -8966,7 +8966,7 @@ struct
                 let cond = run cond in
                 let cond = if should_cache then mk_cast cond_etype cond else cond in
 
-                mk_local var cond.epos, [ { eexpr = TVars([var,Some(cond)]); etype = basic.tvoid; epos = cond.epos } ]
+                mk_local var cond.epos, [ { eexpr = TVar([var,Some(cond)]); etype = basic.tvoid; epos = cond.epos } ]
             in
 
             let mk_eq cond =
@@ -9212,7 +9212,7 @@ struct
                               v, mk_local v e1.epos, e1
                           in
                           { e with eexpr = TBlock([
-                            { eexpr = TVars([v, Some evars ]); etype = gen.gcon.basic.tvoid; epos = e.epos };
+                            { eexpr = TVar([v, Some evars ]); etype = gen.gcon.basic.tvoid; epos = e.epos };
                             { e with eexpr = TBinop( Ast.OpAssign, e1, handle_wrap { e with eexpr = TBinop (op, handle_unwrap t1 e1, handle_unwrap t2 (run e2) ) } t1 ) }
                           ]) }
                       )
@@ -9695,7 +9695,7 @@ struct
         (* var v = (temp_var == null) ? const : cast temp_var; *)
         block :=
         {
-          eexpr = TVars([var, Some(
+          eexpr = TVar([var, Some(
           {
             eexpr = TIf(
               { eexpr = TBinop(Ast.OpEq, mk_local nullable_var pos, null nullable_var.v_type pos); etype = basic.tbool; epos = pos },
@@ -10233,7 +10233,7 @@ struct
                 f.cf_expr <- Some({ e with
                   eexpr = TFunction({ tf with
                     tf_args = List.rev new_args;
-                    tf_expr = Codegen.concat { eexpr = TVars(vardecl); etype = gen.gcon.basic.tvoid; epos = e.epos } tf.tf_expr
+                    tf_expr = Codegen.concat { eexpr = TVar(vardecl); etype = gen.gcon.basic.tvoid; epos = e.epos } tf.tf_expr
                   });
                 });
                 f

+ 5 - 5
gencpp.ml

@@ -803,7 +803,7 @@ let rec iter_retval f retval e =
 	| TCall (e,el) ->
 		f true e;
 		List.iter (f true) el
-	| TVars (_,eo) ->
+	| TVar (_,eo) ->
 		(match eo with None -> () | Some e -> f true e)
 	| TFunction fu ->
 		f false fu.tf_expr
@@ -892,7 +892,7 @@ let find_undeclared_variables_ctx ctx undeclared declarations this_suffix allow_
 	let output = ctx.ctx_output in
 	let rec find_undeclared_variables undeclared declarations this_suffix allow_this expression =
 		match expression.eexpr with
-		| TVars (tvar,optional_init) ->
+		| TVar (tvar,optional_init) ->
 				Hashtbl.add declarations (keyword_remap tvar.v_name) ();
 				if (ctx.ctx_debug) then
 					output ("/* found var " ^ tvar.v_name ^ "*/ ");
@@ -1852,7 +1852,7 @@ and gen_expression ctx retval expression =
 			output ("function " ^ func_name ^ " not found.");
 		)
 
-	| TVars (tvar,optional_init) ->
+	| TVar (tvar,optional_init) ->
 		let count = ref 1 in (* TODO: this section can be simplified *)
 		if (retval && !count==1) then
 			(match optional_init with
@@ -2389,7 +2389,7 @@ let find_referenced_types ctx obj super_deps constructor_deps header_only for_de
                with Not_found -> ();
                end
 				(* Must visit type too, Type.iter will visit the expressions ... *)
-				| TVars (v,_) ->
+				| TVar (v,_) ->
 					 visit_type v.v_type
 				(* Must visit args too, Type.iter will visit the expressions ... *)
 				| TFunction func_def ->
@@ -4176,7 +4176,7 @@ class script_writer common_ctx ctx filename =
      (* TODO - lval op-assign local/member/array *)
      | TLocal var -> this#write ("VAR " ^ (string_of_int var.v_id) );
 
-     | TVars (tvar,optional_init) ->
+     | TVar (tvar,optional_init) ->
          this#write ("TVARS " ^ (string_of_int (1)) ^ "\n");
             this#write ("\t\t" ^ indent);
             (match optional_init with

+ 9 - 9
gencs.ml

@@ -209,7 +209,7 @@ struct
                 | TLocal(v) -> mk_is obj
                 | _ ->
                   let var = mk_temp gen "is" obj.etype in
-                  let added = { obj with eexpr = TVars([var, Some(obj)]); etype = basic.tvoid } in
+                  let added = { obj with eexpr = TVar([var, Some(obj)]); etype = basic.tvoid } in
                   let local = mk_local var obj.epos in
                   {
                     eexpr = TBlock([ added; mk_is local ]);
@@ -242,7 +242,7 @@ struct
 
           let mk_local obj =
             let var = mk_temp gen "opUshr" obj.etype in
-            let added = { obj with eexpr = TVars([var, Some(obj)]); etype = basic.tvoid } in
+            let added = { obj with eexpr = TVar([var, Some(obj)]); etype = basic.tvoid } in
             let local = mk_local var obj.epos in
             local, added
           in
@@ -459,7 +459,7 @@ let handle_type_params gen ifaces base_generic =
       let obj_v = mk_temp gen "obj" t_dynamic in
       let block = [
         {
-          eexpr = TVars(
+          eexpr = TVar(
           [
             new_v, Some( {
               eexpr = TNew(native_arr_cl, [new_param], [old_len] );
@@ -483,7 +483,7 @@ let handle_type_params gen ifaces base_generic =
             },
             { eexpr = TBlock [
               {
-                eexpr = TVars([obj_v, Some (mk_cast t_dynamic { eexpr = TArray(e, mk_local i e.epos); etype = old_param; epos = e.epos })]);
+                eexpr = TVar([obj_v, Some (mk_cast t_dynamic { eexpr = TArray(e, mk_local i e.epos); etype = old_param; epos = e.epos })]);
                 etype = basic.tvoid;
                 epos = e.epos
               };
@@ -1086,14 +1086,14 @@ let configure gen =
         | TCall ({ eexpr = TLocal( { v_name = "__fixed__" } ) }, [ e ] ) ->
           let first = ref true in
           let rec loop = function
-            | ({ eexpr = TVars([v, Some({ eexpr = TCast( { eexpr = TCast(e, _) }, _) }) ]) } as expr) :: tl when is_pointer v.v_type ->
+            | ({ eexpr = TVar([v, Some({ eexpr = TCast( { eexpr = TCast(e, _) }, _) }) ]) } as expr) :: tl when is_pointer v.v_type ->
               (if !first then first := false);
               write w "fixed(";
               let vf = mk_temp gen "fixed" v.v_type in
-              expr_s w { expr with eexpr = TVars([vf, Some e]) };
+              expr_s w { expr with eexpr = TVar([vf, Some e]) };
               write w ")";
               begin_block w;
-              expr_s w { expr with eexpr = TVars([v, Some (mk_local vf expr.epos)]) };
+              expr_s w { expr with eexpr = TVar([v, Some (mk_local vf expr.epos)]) };
               write w ";";
               loop tl;
               end_block w
@@ -1188,7 +1188,7 @@ let configure gen =
           (match flag with
             | Ast.Prefix -> write w ( " " ^ (Ast.s_unop op) ^ " (" ); expr_s w e; write w ") "
             | Ast.Postfix -> write w "("; expr_s w e; write w (") " ^ Ast.s_unop op))
-        | TVars (v_eop_l) ->
+        | TVar (v_eop_l) ->
           ignore (List.fold_left (fun acc (var, eopt) ->
             (if acc <> 0 then write w ", ");
             print w "%s " (t_s var.v_type);
@@ -2372,7 +2372,7 @@ let configure gen =
       | _ -> assert false
   ) true ) ;
 
-  ExpressionUnwrap.configure gen (ExpressionUnwrap.traverse gen (fun e -> Some { eexpr = TVars([mk_temp gen "expr" e.etype, Some e]); etype = gen.gcon.basic.tvoid; epos = e.epos }));
+  ExpressionUnwrap.configure gen (ExpressionUnwrap.traverse gen (fun e -> Some { eexpr = TVar([mk_temp gen "expr" e.etype, Some e]); etype = gen.gcon.basic.tvoid; epos = e.epos }));
 
   UnnecessaryCastsRemoval.configure gen;
 

+ 5 - 5
genjava.ml

@@ -367,7 +367,7 @@ struct
       | TLocal _ -> e1
       | _ ->
         let var = mk_temp gen "svar" e1.etype in
-        let added = { e1 with eexpr = TVars([var, Some(e1)]); etype = basic.tvoid } in
+        let added = { e1 with eexpr = TVar([var, Some(e1)]); etype = basic.tvoid } in
         let local = mk_local var e1.epos in
         block := added :: !block;
         local
@@ -392,7 +392,7 @@ struct
         | None ->
           let var = mk_temp gen "hash" basic.tint in
           let cond = !local_hashcode in
-          block := { eexpr = TVars([var, Some cond]); etype = basic.tvoid; epos = local.epos } :: !block;
+          block := { eexpr = TVar([var, Some cond]); etype = basic.tvoid; epos = local.epos } :: !block;
           let local = mk_local var local.epos in
           local_hashcode := local;
           hash_cache := Some local;
@@ -503,7 +503,7 @@ struct
       eexpr = TSwitch(!local_hashcode, List.map change_case (reorder_cases ecases []), None);
     } in
     (if !has_case then begin
-      (if has_default then block := { e1 with eexpr = TVars([execute_def_var, Some({ e1 with eexpr = TConst(TBool true); etype = basic.tbool })]); etype = basic.tvoid } :: !block);
+      (if has_default then block := { e1 with eexpr = TVar([execute_def_var, Some({ e1 with eexpr = TConst(TBool true); etype = basic.tbool })]); etype = basic.tvoid } :: !block);
       block := switch :: !block
     end);
     (match edefault with
@@ -1272,7 +1272,7 @@ let configure gen =
           (match flag with
             | Ast.Prefix -> write w ( " " ^ (Ast.s_unop op) ^ " (" ); expr_s w e; write w ") "
             | Ast.Postfix -> write w "("; expr_s w e; write w (") " ^ Ast.s_unop op))
-        | TVars (v_eop_l) ->
+        | TVar (v_eop_l) ->
           ignore (List.fold_left (fun acc (var, eopt) ->
             (if acc <> 0 then write w "; ");
             print w "%s " (t_s e.epos var.v_type);
@@ -2091,7 +2091,7 @@ let configure gen =
 
   let native_arr_cl = get_cl ( get_type gen (["java"], "NativeArray") ) in
 
-  ExpressionUnwrap.configure gen (ExpressionUnwrap.traverse gen (fun e -> Some { eexpr = TVars([mk_temp gen "expr" e.etype, Some e]); etype = gen.gcon.basic.tvoid; epos = e.epos }));
+  ExpressionUnwrap.configure gen (ExpressionUnwrap.traverse gen (fun e -> Some { eexpr = TVar([mk_temp gen "expr" e.etype, Some e]); etype = gen.gcon.basic.tvoid; epos = e.epos }));
 
   UnnecessaryCastsRemoval.configure gen;
 

+ 2 - 2
genjs.ml

@@ -524,7 +524,7 @@ and gen_expr ctx e =
 	| TThrow e ->
 		spr ctx "throw ";
 		gen_value ctx e;
-	| TVars (v,eo) ->
+	| TVar (v,eo) ->
 		spr ctx "var ";
 		check_var_declaration v;
 		spr ctx (ident v.v_name);
@@ -783,7 +783,7 @@ and gen_value ctx e =
 		spr ctx " , ";
 		spr ctx (ctx.type_accessor t);
 		spr ctx ")"
-	| TVars _
+	| TVar _
 	| TFor _
 	| TWhile _
 	| TThrow _ ->

+ 1 - 1
genneko.ml

@@ -270,7 +270,7 @@ and gen_expr ctx e =
 		call p (field p (gen_type_path p c.cl_path) "new") (List.map (gen_expr ctx) params)
 	| TUnop (op,flag,e) ->
 		gen_unop ctx p op flag e
-	| TVars (v,eo) ->
+	| TVar (v,eo) ->
 		(EVars (
 			let e = (match eo with
 				| None ->

+ 2 - 2
genphp.ml

@@ -1384,7 +1384,7 @@ and gen_expr ctx e =
 		spr ctx "throw new HException(";
 		gen_value ctx e;
 		spr ctx ")";
-	| TVars (v,eo) ->
+	| TVar (v,eo) ->
 		spr ctx "$";
 		let restore = save_locals ctx in
 		let n = define_local ctx v.v_name in
@@ -1772,7 +1772,7 @@ and gen_value ctx e =
 	| TBlock _
 	| TBreak
 	| TContinue
-	| TVars _
+	| TVar _
 	| TReturn _
 	| TWhile _
 	| TThrow _

+ 1 - 1
genswf.ml

@@ -623,7 +623,7 @@ let build_dependencies t =
 			add_type v.v_type;
 			add_expr e1;
 			add_expr e2;
-		| TVars (v,eo) ->
+		| TVar (v,eo) ->
 				add_type v.v_type;
 			begin match eo with
 				| None -> ()

+ 1 - 1
genswf8.ml

@@ -997,7 +997,7 @@ and gen_expr_2 ctx retval e =
 		let b = open_block ctx in
 		loop el;
 		b()
-	| TVars (v,eo) ->
+	| TVar (v,eo) ->
 		define_var ctx v (match eo with None -> None | Some e -> Some (fun() -> gen_expr ctx true e));
 		if retval then push ctx [VNull]
 	| TArrayDecl el ->

+ 1 - 1
genswf9.ml

@@ -1024,7 +1024,7 @@ let rec gen_expr_content ctx retval e =
 		let b = open_block ctx retval in
 		loop el;
 		b();
-	| TVars (v,ei) ->
+	| TVar (v,ei) ->
 		define_local ctx v e.epos;
 		(match ei with
 		| None -> ()

+ 3 - 3
interp.ml

@@ -4469,7 +4469,7 @@ and encode_texpr e =
 			| TNew(c,pl,el) -> 10,[encode_clref c;encode_tparams pl;encode_texpr_list el]
 			| TUnop(op,flag,e1) -> 11,[encode_unop op;VBool (flag = Postfix);loop e1]
 			| TFunction func -> 12,[encode_tfunc func]
-			| TVars (v,eo) -> 13,[
+			| TVar (v,eo) -> 13,[
 				enc_obj [
 					"v",encode_tvar v;
 					"expr",vopt encode_texpr eo
@@ -4635,7 +4635,7 @@ let rec decode_texpr v =
 		| 10, [c;tl;vl] -> TNew(decode_ref c,List.map decode_type (dec_array tl),List.map loop (dec_array vl))
 		| 11, [op;pf;v1] -> TUnop(decode_unop op,(if dec_bool pf then Postfix else Prefix),loop v1)
 		| 12, [f] -> TFunction(decode_tfunc f)
-		| 13, [v;eo] -> TVars(decode_tvar v,opt loop eo)
+		| 13, [v;eo] -> TVar(decode_tvar v,opt loop eo)
 		| 14, [vl] -> TBlock(List.map loop (dec_array vl))
 		| 15, [v;v1;v2] -> TFor(decode_tvar v,loop v1,loop v2)
 		| 16, [vif;vthen;velse] -> TIf(loop vif,loop vthen,opt loop velse)
@@ -4864,7 +4864,7 @@ let rec make_ast e =
 	| TFunction f ->
 		let arg (v,c) = v.v_name, false, mk_ot v.v_type, (match c with None -> None | Some c -> Some (EConst (mk_const c),e.epos)) in
 		EFunction (None,{ f_params = []; f_args = List.map arg f.tf_args; f_type = mk_ot f.tf_type; f_expr = Some (make_ast f.tf_expr) })
-	| TVars (v,eo) ->
+	| TVar (v,eo) ->
 		EVars ([v.v_name, mk_ot v.v_type, eopt eo])
 	| TBlock el -> EBlock (List.map make_ast el)
 	| TFor (v,it,e) ->

+ 19 - 19
optimizer.ml

@@ -35,7 +35,7 @@ let has_side_effect e =
 		| TConst _ | TLocal _ | TField _ | TTypeExpr _ | TFunction _ -> ()
 		| TPatMatch _ | TNew _ | TCall _ | TBinop ((OpAssignOp _ | OpAssign),_,_) | TUnop ((Increment|Decrement),_,_) -> raise Exit
 		| TReturn _ | TBreak | TContinue | TThrow _ | TCast (_,Some _) -> raise Exit
-		| TArray _ | TEnumParameter _ | TCast (_,None) | TBinop _ | TUnop _ | TParenthesis _ | TMeta _ | TWhile _ | TFor _ | TIf _ | TTry _ | TSwitch _ | TArrayDecl _ | TVars _ | TBlock _ | TObjectDecl _ -> Type.iter loop e
+		| TArray _ | TEnumParameter _ | TCast (_,None) | TBinop _ | TUnop _ | TParenthesis _ | TMeta _ | TWhile _ | TFor _ | TIf _ | TTry _ | TSwitch _ | TArrayDecl _ | TVar _ | TBlock _ | TObjectDecl _ -> Type.iter loop e
 	in
 	try
 		loop e; false
@@ -222,9 +222,9 @@ let rec type_inline ctx cf f ethis params tret config p force =
 			let l = read_local vthis in
 			l.i_read <- l.i_read + (if !in_loop then 2 else 1);
 			{ e with eexpr = TLocal l.i_subst }
-		| TVars (v,eo) ->
+		| TVar (v,eo) ->
 			has_vars := true;
-			{ e with eexpr = TVars ((local v).i_subst,opt (map false) eo)}
+			{ e with eexpr = TVar ((local v).i_subst,opt (map false) eo)}
 		| TReturn eo when not !in_local_fun ->
 			if not term then error "Cannot inline a not final return" po;
 			(match eo with
@@ -422,10 +422,10 @@ let rec type_inline ctx cf f ethis params tret config p force =
 			| TBlock [e] , None -> wrap e
 			| _ , None -> wrap e
 			| TBlock l, Some vl ->
-				let el_v = List.map (fun (v,eo) -> mk (TVars (v,eo)) ctx.t.tvoid e.epos) vl in
+				let el_v = List.map (fun (v,eo) -> mk (TVar (v,eo)) ctx.t.tvoid e.epos) vl in
 				mk (TBlock (el_v @ l)) tret e.epos
 			| _, Some vl ->
-				let el_v = List.map (fun (v,eo) -> mk (TVars (v,eo)) ctx.t.tvoid e.epos) vl in
+				let el_v = List.map (fun (v,eo) -> mk (TVar (v,eo)) ctx.t.tvoid e.epos) vl in
 				mk (TBlock (el_v @ [e])) tret e.epos
 		) in
 		(* we need to replace type-parameters that were used in the expression *)
@@ -481,7 +481,7 @@ let rec optimize_for_loop ctx i e1 e2 p =
 		) in
 		let iexpr = mk (TLocal index) t_int p in
 		let e2 = type_expr ctx e2 NoValue in
-		let aget = mk (TVars (i,Some (mk (TArray (arr,iexpr)) pt p))) t_void p in
+		let aget = mk (TVar (i,Some (mk (TArray (arr,iexpr)) pt p))) t_void p in
 		let incr = mk (TUnop (Increment,Prefix,iexpr)) t_int p in
 		let block = match e2.eexpr with
 			| TBlock el -> mk (TBlock (aget :: incr :: el)) t_void e2.epos
@@ -502,8 +502,8 @@ let rec optimize_for_loop ctx i e1 e2 p =
 				NormalWhile
 			)) t_void p;
 		] in
-		let el = match avars with None -> el | Some (v,eo) -> (mk (TVars (v,eo)) t_void p) :: el in
-		let el = (mk (TVars (index,ivar)) t_void p) :: el in
+		let el = match avars with None -> el | Some (v,eo) -> (mk (TVar (v,eo)) t_void p) :: el in
+		let el = (mk (TVar (index,ivar)) t_void p) :: el in
 		lblock el
 	in
 	match e1.eexpr, follow e1.etype with
@@ -529,7 +529,7 @@ let rec optimize_for_loop ctx i e1 e2 p =
 		check e2;
 		let etmp = mk (TLocal tmp) t_int p in
 		let incr = mk (TUnop (Increment,Postfix,etmp)) t_int p in
-		let init = mk (TVars (i,Some incr)) t_void p in
+		let init = mk (TVar (i,Some incr)) t_void p in
 		let block = match e2.eexpr with
 			| TBlock el -> mk (TBlock (init :: el)) t_void e2.epos
 			| _ -> mk (TBlock [init;e2]) t_void p
@@ -544,7 +544,7 @@ let rec optimize_for_loop ctx i e1 e2 p =
 		(match max with
 		| None ->
 			lblock [
-				mk (TVars (tmp,Some i1)) t_void p;
+				mk (TVar (tmp,Some i1)) t_void p;
 				mk (TWhile (
 					mk (TBinop (OpLt, etmp, i2)) ctx.t.tbool p,
 					block,
@@ -553,8 +553,8 @@ let rec optimize_for_loop ctx i e1 e2 p =
 			]
 		| Some max ->
 			lblock [
-				mk (TVars (tmp,Some i1)) t_void p;
-				mk (TVars (max,Some i2)) t_void p;
+				mk (TVar (tmp,Some i1)) t_void p;
+				mk (TVar (max,Some i2)) t_void p;
 				mk (TWhile (
 					mk (TBinop (OpLt, etmp, mk (TLocal max) t_int p)) ctx.t.tbool p,
 					block,
@@ -574,14 +574,14 @@ let rec optimize_for_loop ctx i e1 e2 p =
 		let cell = gen_local ctx tcell in
 		let cexpr = mk (TLocal cell) tcell p in
 		let e2 = type_expr ctx e2 NoValue in
-		let evar = mk (TVars (i,Some (mk (mk_field cexpr "elt") t p))) t_void p in
+		let evar = mk (TVar (i,Some (mk (mk_field cexpr "elt") t p))) t_void p in
 		let enext = mk (TBinop (OpAssign,cexpr,mk (mk_field cexpr "next") tcell p)) tcell p in
 		let block = match e2.eexpr with
 			| TBlock el -> mk (TBlock (evar :: enext :: el)) t_void e2.epos
 			| _ -> mk (TBlock [evar;enext;e2]) t_void p
 		in
 		lblock [
-			mk (TVars (cell,Some (mk (mk_field e1 "head") tcell p))) t_void p;
+			mk (TVar (cell,Some (mk (mk_field e1 "head") tcell p))) t_void p;
 			mk (TWhile (
 				mk (TBinop (OpNotEq, cexpr, mk (TConst TNull) tcell p)) ctx.t.tbool p,
 				block,
@@ -627,7 +627,7 @@ let rec need_parent e =
 	| TConst _ | TLocal _ | TArray _ | TField _ | TEnumParameter _ | TParenthesis _ | TMeta _ | TCall _ | TNew _ | TTypeExpr _ | TObjectDecl _ | TArrayDecl _ -> false
 	| TCast (e,None) -> need_parent e
 	| TCast _ | TThrow _ | TReturn _ | TTry _ | TPatMatch _ | TSwitch _ | TFor _ | TIf _ | TWhile _ | TBinop _ | TContinue | TBreak
-	| TBlock _ | TVars _ | TFunction _ | TUnop _ -> true
+	| TBlock _ | TVar _ | TFunction _ | TUnop _ -> true
 
 let sanitize_expr com e =
 	let parent e =
@@ -643,7 +643,7 @@ let sanitize_expr com e =
 	let complex e =
 		(* complex expressions are the one that once generated to source consists in several expressions  *)
 		match e.eexpr with
-		| TVars _	(* needs to be put into blocks *)
+		| TVar _	(* needs to be put into blocks *)
 		| TFor _	(* a temp var is needed for holding iterator *)
 		| TPatMatch _	(* a temp var is needed for holding enum *)
 		| TCall ({ eexpr = TLocal { v_name = "__js__" } },_) (* we never know *)
@@ -1011,7 +1011,7 @@ let inline_constructors ctx e =
 	in
 	let rec find_locals e =
 		match e.eexpr with
-		| TVars (v,eo) ->
+		| TVar (v,eo) ->
 			Type.iter find_locals e;
 			begin match eo with
 				| Some n ->
@@ -1078,7 +1078,7 @@ let inline_constructors ctx e =
 		) vars in
 		let rec subst e =
 			match e.eexpr with
-			| TVars (v,eo) ->
+			| TVar (v,eo) ->
 				let v,eo = match eo with
 					| None -> (v,None)
 					| Some e when v.v_id < 0 ->
@@ -1087,7 +1087,7 @@ let inline_constructors ctx e =
 					| Some e ->
 						v,Some (subst e)
 				in
-				mk (TVars (v,eo)) e.etype e.epos
+				mk (TVar (v,eo)) e.etype e.epos
 			| TField ({ eexpr = TLocal v },FInstance (_,cf)) when v.v_id < 0 ->
 				let _, vars = PMap.find (-v.v_id) vfields in
 				(try

+ 1 - 1
std/haxe/macro/Type.hx

@@ -251,7 +251,7 @@ enum TypedExprDef {
 	TNew(c:Ref<ClassType>, params: Array<Type>, el:Array<TypedExpr>);
 	TUnop(op:Expr.Unop, postFix:Bool, e:TypedExpr);
 	TFunction(tfunc:TFunc);
-	TVars(v:TVar, expr:Null<TypedExpr>);
+	TVar(v:TVar, expr:Null<TypedExpr>);
 	TBlock(el:Array<TypedExpr>);
 	TFor(v:TVar, e1:TypedExpr, e2:TypedExpr);
 	TIf(econd:TypedExpr, eif:TypedExpr, eelse:Null<TypedExpr>);

+ 2 - 2
std/haxe/macro/TypedExprTools.hx

@@ -60,7 +60,7 @@ class TypedExprTools {
 			case TBlock(el): with(e, TBlock(el.map(f)));
 			case TObjectDecl(fl): with(e, TObjectDecl(fl.map(function(field) return { name: field.name, expr: f(field.expr) })));
 			case TCall(e1, el): with(e, TCall(f(e1), el.map(f)));
-			case TVars(v,eo): with(e, TVars(v, eo == null ? null : f(eo)));
+			case TVar(v,eo): with(e, TVar(v, eo == null ? null : f(eo)));
 			case TFunction(fu): with(e, TFunction({ t: fu.t, args: fu.args, expr: f(fu.expr)}));
 			case TIf(e1, e2, e3): with(e, TIf(f(e1), f(e2), f(e3)));
 			case TSwitch(e1, cases, e2): with(e, TSwitch(e1, cases.map(function(c) return { values: c.values, expr: f(c.expr) }), e2 == null ? null : f(e2)));
@@ -99,7 +99,7 @@ class TypedExprTools {
 			case TBlock(el): with(e, TBlock(el.map(f)), ft(e.t));
 			case TObjectDecl(fl): with(e, TObjectDecl(fl.map(function(field) return { name: field.name, expr: f(field.expr) })), ft(e.t));
 			case TCall(e1, el): with(e, TCall(f(e1), el.map(f)), ft(e.t));
-			case TVars(v,eo): with(e, TVars(fv(v), eo == null ? null : f(eo)), ft(e.t));
+			case TVar(v,eo): with(e, TVar(fv(v), eo == null ? null : f(eo)), ft(e.t));
 			case TFunction(fu): with(e, TFunction({ t: ft(fu.t), args: fu.args.map(function(arg) return { v: fv(arg.v), value: arg.value }), expr: f(fu.expr)}), ft(e.t));
 			case TIf(e1, e2, e3): with(e, TIf(f(e1), f(e2), f(e3)), ft(e.t));
 			case TSwitch(e1, cases, e2): with(e, TSwitch(e1, cases.map(function(c) return { values: c.values, expr: f(c.expr) }), e2 == null ? null : f(e2)), ft(e.t));

+ 9 - 9
type.ml

@@ -114,7 +114,7 @@ and texpr_expr =
 	| TNew of tclass * tparams * texpr list
 	| TUnop of Ast.unop * Ast.unop_flag * texpr
 	| TFunction of tfunc
-	| TVars of tvar * texpr option
+	| TVar of tvar * texpr option
 	| TBlock of texpr list
 	| TFor of tvar * texpr * texpr
 	| TIf of texpr * texpr * texpr option
@@ -1350,7 +1350,7 @@ let iter f e =
 	| TCall (e,el) ->
 		f e;
 		List.iter f el
-	| TVars (v,eo) ->
+	| TVar (v,eo) ->
 		(match eo with None -> () | Some e -> f e)
 	| TFunction fu ->
 		f fu.tf_expr
@@ -1427,8 +1427,8 @@ let map_expr f e =
 		{ e with eexpr = TObjectDecl (List.map (fun (v,e) -> v, f e) el) }
 	| TCall (e1,el) ->
 		{ e with eexpr = TCall (f e1, List.map f el) }
-	| TVars (v,eo) ->
-		{ e with eexpr = TVars (v, match eo with None -> None | Some e -> Some (f e)) }
+	| TVar (v,eo) ->
+		{ e with eexpr = TVar (v, match eo with None -> None | Some e -> Some (f e)) }
 	| TFunction fu ->
 		{ e with eexpr = TFunction { fu with tf_expr = f fu.tf_expr } }
 	| TIf (ec,e1,e2) ->
@@ -1505,8 +1505,8 @@ let map_expr_type f ft fv e =
 	| TCall (e1,el) ->
 		let e1 = f e1 in
 		{ e with eexpr = TCall (e1, List.map f el); etype = ft e.etype }
-	| TVars (v,eo) ->
-		{ e with eexpr = TVars (fv v, match eo with None -> None | Some e -> Some (f e)); etype = ft e.etype }
+	| TVar (v,eo) ->
+		{ e with eexpr = TVar (fv v, match eo with None -> None | Some e -> Some (f e)); etype = ft e.etype }
 	| TFunction fu ->
 		let fu = {
 			tf_expr = f fu.tf_expr;
@@ -1558,7 +1558,7 @@ let s_expr_kind e =
 	| TNew (_,_,_) -> "New"
 	| TUnop (_,_,_) -> "Unop"
 	| TFunction _ -> "Function"
-	| TVars _ -> "Vars"
+	| TVar _ -> "Vars"
 	| TBlock _ -> "Block"
 	| TFor (_,_,_) -> "For"
 	| TIf (_,_,_) -> "If"
@@ -1627,7 +1627,7 @@ let rec s_expr s_type e =
 	| TFunction f ->
 		let args = slist (fun (v,o) -> sprintf "%s : %s%s" (s_var v) (s_type v.v_type) (match o with None -> "" | Some c -> " = " ^ s_const c)) f.tf_args in
 		sprintf "Function(%s) : %s = %s" args (s_type f.tf_type) (loop f.tf_expr)
-	| TVars (v,eo) ->
+	| TVar (v,eo) ->
 		sprintf "Vars %s" (sprintf "%s : %s%s" (s_var v) (s_type v.v_type) (match eo with None -> "" | Some e -> " = " ^ loop e))
 	| TBlock el ->
 		sprintf "Block {\n%s}" (String.concat "" (List.map (fun e -> sprintf "%s;\n" (loop e)) el))
@@ -1702,7 +1702,7 @@ let rec s_expr_pretty tabs s_type e =
 	| TFunction f ->
 		let args = slist (fun (v,o) -> sprintf "%s:%s%s" v.v_name (s_type v.v_type) (match o with None -> "" | Some c -> " = " ^ s_const c)) f.tf_args in
 		sprintf "function(%s) = %s" args (loop f.tf_expr)
-	| TVars (v,eo) ->
+	| TVar (v,eo) ->
 		sprintf "var %s" (sprintf "%s%s" v.v_name (match eo with None -> "" | Some e -> " = " ^ loop e))
 	| TBlock el ->
 		let ntabs = tabs ^ "\t" in

+ 1 - 1
typeload.ml

@@ -1222,7 +1222,7 @@ let type_function ctx args ret fmode f do_display p =
 	locals();
 	let e = match ctx.curfun, ctx.vthis with
 		| (FunMember|FunConstructor), Some v ->
-			let ev = mk (TVars (v,Some (mk (TConst TThis) ctx.tthis p))) ctx.t.tvoid p in
+			let ev = mk (TVar (v,Some (mk (TConst TThis) ctx.tthis p))) ctx.t.tvoid p in
 			(match e.eexpr with
 			| TBlock l -> { e with eexpr = TBlock (ev::l) }
 			| _ -> mk (TBlock [ev;e]) e.etype p)

+ 15 - 15
typer.ml

@@ -1559,7 +1559,7 @@ let rec type_binop ctx op e1 e2 is_assign_op p =
 			unify ctx get.etype t p;
 			l();
 			mk (TBlock [
-				mk (TVars (v,Some e)) ctx.t.tvoid p;
+				mk (TVar (v,Some e)) ctx.t.tvoid p;
 				make_call ctx (mk (TField (ev,quick_field_dynamic ev.etype ("set_" ^ cf.cf_name))) (tfun [t] t) p) [get] t p
 			]) t p
  		| AKUsing(ef,c,cf,et) ->
@@ -1578,7 +1578,7 @@ let rec type_binop ctx op e1 e2 is_assign_op p =
 			unify ctx get.etype ret p;
 			l();
 			mk (TBlock [
-				mk (TVars (v,Some et)) ctx.t.tvoid p;
+				mk (TVar (v,Some et)) ctx.t.tvoid p;
 				make_call ctx ef [ev;get] ret p
 			]) ret p
 		| AKAccess(ebase,ekey) ->
@@ -1595,7 +1595,7 @@ let rec type_binop ctx op e1 e2 is_assign_op p =
 					let save = save_locals ctx in
 					let v = gen_local ctx ekey.etype in
 					let e = mk (TLocal v) ekey.etype p in
-					e, fun () -> (save(); Some (mk (TVars (v,Some ekey)) ctx.t.tvoid p))
+					e, fun () -> (save(); Some (mk (TVar (v,Some ekey)) ctx.t.tvoid p))
 			in
 			let ast_call = ECall((EField(Interp.make_ast ebase,cf_get.cf_name),p),[Interp.make_ast ekey]),p in
 			let eget = type_binop ctx op ast_call e2 true p in
@@ -1943,7 +1943,7 @@ and type_unop ctx op flag e p =
 			unify ctx get.etype t p;
 			l();
 			mk (TBlock [
-				mk (TVars (v,Some e)) ctx.t.tvoid p;
+				mk (TVar (v,Some e)) ctx.t.tvoid p;
 				make_call ctx (mk (TField (ev,quick_field_dynamic ev.etype ("set_" ^ cf.cf_name))) (tfun [t] t) p) [get] t p
 			]) t p
 		| Postfix ->
@@ -1954,8 +1954,8 @@ and type_unop ctx op flag e p =
 			unify ctx get.etype t p;
 			l();
 			mk (TBlock [
-				mk (TVars (v,Some e)) ctx.t.tvoid p;
-				mk (TVars (v2,Some get)) ctx.t.tvoid p;
+				mk (TVar (v,Some e)) ctx.t.tvoid p;
+				mk (TVar (v2,Some get)) ctx.t.tvoid p;
 				make_call ctx (mk (TField (ev,quick_field_dynamic ev.etype ("set_" ^ cf.cf_name))) (tfun [plusone.etype] t) p) [plusone] t p;
 				ev2
 			]) t p
@@ -2237,9 +2237,9 @@ and type_vars ctx vl p in_block =
 	save();
 
 	match vl with
-	| [v,eo] -> mk (TVars (v,eo)) ctx.t.tvoid p
+	| [v,eo] -> mk (TVar (v,eo)) ctx.t.tvoid p
 	| _ ->
-		let e = mk (TBlock (List.map (fun (v,e) -> (mk (TVars (v,e)) ctx.t.tvoid p)) vl)) ctx.t.tvoid p in
+		let e = mk (TBlock (List.map (fun (v,e) -> (mk (TVar (v,e)) ctx.t.tvoid p)) vl)) ctx.t.tvoid p in
 		mk (TMeta((Meta.MergeBlock,[],p), e)) e.etype e.epos
 
 and with_type_error ctx with_type msg p =
@@ -2512,7 +2512,7 @@ and type_expr ctx (e,p) (with_type:with_type) =
 		unify ctx v.v_type ea.etype p;
 		let efor = type_expr ctx e NoValue in
 		mk (TBlock [
-			mk (TVars (v,Some ea)) ctx.t.tvoid p;
+			mk (TVar (v,Some ea)) ctx.t.tvoid p;
 			efor;
 			mk (TLocal v) v.v_type p;
 		]) v.v_type p
@@ -2559,7 +2559,7 @@ and type_expr ctx (e,p) (with_type:with_type) =
 				error "Expected a => b" (snd e)
 		) [] el in
 		let enew = mk (TNew(c,[tkey;tval],[])) tmap p in
-		let el = (mk (TVars (v,Some enew)) t_dynamic p) :: (List.rev el) in
+		let el = (mk (TVar (v,Some enew)) t_dynamic p) :: (List.rev el) in
 		mk (TBlock el) tmap p
 	| EArrayDecl el ->
 		let tp = (match with_type with
@@ -2647,13 +2647,13 @@ and type_expr ctx (e,p) (with_type:with_type) =
 					let tmp = gen_local ctx e1.etype in
 					let eit = mk (TLocal tmp) e1.etype p in
 					let ehasnext = make_call ctx (mk (TField (eit,FInstance (c, fhasnext))) (TFun([],ctx.t.tbool)) p) [] ctx.t.tbool p in
-					let enext = mk (TVars (i,Some (make_call ctx (mk (TField (eit,FDynamic "next")) (TFun ([],pt)) p) [] pt p))) ctx.t.tvoid p in
+					let enext = mk (TVar (i,Some (make_call ctx (mk (TField (eit,FDynamic "next")) (TFun ([],pt)) p) [] pt p))) ctx.t.tvoid p in
 					let eblock = (match e2.eexpr with
 						| TBlock el -> { e2 with eexpr = TBlock (enext :: el) }
 						| _ -> mk (TBlock [enext;e2]) ctx.t.tvoid p
 					) in
 					mk (TBlock [
-						mk (TVars (tmp,Some e1)) ctx.t.tvoid p;
+						mk (TVar (tmp,Some e1)) ctx.t.tvoid p;
 						mk (TWhile (ehasnext,eblock,NormalWhile)) ctx.t.tvoid p
 					]) ctx.t.tvoid p
 				with Exit ->
@@ -2929,15 +2929,15 @@ and type_expr ctx (e,p) (with_type:with_type) =
 			let decl = (if is_rec then begin
 				if inline then display_error ctx "Inline function cannot be recursive" e.epos;
 				let vnew = add_local ctx v.v_name ft in
-				mk (TVars (vnew,Some (mk (TBlock [
-					mk (TVars (v,Some (mk (TConst TNull) ft p))) ctx.t.tvoid p;
+				mk (TVar (vnew,Some (mk (TBlock [
+					mk (TVar (v,Some (mk (TConst TNull) ft p))) ctx.t.tvoid p;
 					mk (TBinop (OpAssign,mk (TLocal v) ft p,e)) ft p;
 					mk (TLocal v) ft p
 				]) ft p))) ctx.t.tvoid p
 			end else if inline then
 				mk (TBlock []) ctx.t.tvoid p (* do not add variable since it will be inlined *)
 			else
-				mk (TVars (v,Some e)) ctx.t.tvoid p
+				mk (TVar (v,Some e)) ctx.t.tvoid p
 			) in
 			if with_type <> NoValue && not inline then mk (TBlock [decl;mk (TLocal v) v.v_type p]) v.v_type p else decl)
 	| EUntyped e ->