From 50c01b2cfb60fa853a2aec66af829d4434ec7177 Mon Sep 17 00:00:00 2001 From: Nicolas Cannasse Date: Thu, 10 Aug 2017 15:05:38 +0200 Subject: [PATCH] haxe 4 fixes --- hscript/Macro.hx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/hscript/Macro.hx b/hscript/Macro.hx index 2b191d0..02b3ff4 100644 --- a/hscript/Macro.hx +++ b/hscript/Macro.hx @@ -79,6 +79,9 @@ class Macro { #if haxe3 case OpArrow: "=>"; #end + #if (haxe_ver >= 4) + case OpIn: "..."; + #end }; binops.set(str, op); if( assign ) @@ -184,14 +187,16 @@ class Macro { EWhile(convert(c), convert(e), true); case EDoWhile(c, e): EWhile(convert(c), convert(e), false); - #if (haxe_211 || haxe3) case EFor(v, it, efor): - var p = #if hscriptPos { file : p.file, min : e.pmin, max : e.pmax } #else p #end; - EFor({ expr : EIn({ expr : EConst(CIdent(v)), pos : p },convert(it)), pos : p }, convert(efor)); - #else - case EFor(v, it, e): - EFor(v, convert(it), convert(e)); - #end + #if (haxe_ver >= 4) + var p = #if hscriptPos { file : p.file, min : e.pmin, max : e.pmax } #else p #end; + EFor({ expr : EBinop(OpIn,{ expr : EConst(CIdent(v)), pos : p },convert(it)), pos : p }, convert(efor)); + #elseif (haxe_211 || haxe3) + var p = #if hscriptPos { file : p.file, min : e.pmin, max : e.pmax } #else p #end; + EFor({ expr : EIn({ expr : EConst(CIdent(v)), pos : p },convert(it)), pos : p }, convert(efor)); + #else + EFor(v, convert(it), convert(efor)); + #end case EBreak: EBreak; case EContinue: