diff --git a/haxelib.xml b/haxelib.xml
index cda0730..a8cfb81 100644
--- a/haxelib.xml
+++ b/haxelib.xml
@@ -2,5 +2,5 @@
Haxe Script is a scripting engine for a subset of the haXe language
- haxe3/svn support
+ haxe3 support
\ No newline at end of file
diff --git a/hscript/Macro.hx b/hscript/Macro.hx
index 5451c51..c072bde 100644
--- a/hscript/Macro.hx
+++ b/hscript/Macro.hx
@@ -32,12 +32,23 @@ import haxe.macro.Expr;
class Macro {
var p : Position;
+ #if haxe3
+ var binops : Map;
+ var unops : Map;
+ #else
var binops : Hash;
var unops : Hash;
+ #end
public function new(pos) {
p = pos;
+ #if haxe3
+ binops = new Map();
+ unops = new Map();
+ #else
binops = new Hash();
+ unops = new Hash();
+ #end
for( c in Type.getEnumConstructs(Binop) ) {
if( c == "OpAssignOp" ) continue;
var op = Type.createEnum(Binop, c);
@@ -65,12 +76,14 @@ class Macro {
case OpMod: assign = true; "%";
case OpAssignOp(_): "";
case OpInterval: "...";
+ #if haxe3
+ case OpArrow: "=>";
+ #end
};
binops.set(str, op);
if( assign )
binops.set(str + "=", OpAssignOp(op));
}
- unops = new Hash();
for( c in Type.getEnumConstructs(Unop) ) {
var op = Type.createEnum(Unop, c);
var str = switch( op ) {
@@ -84,10 +97,12 @@ class Macro {
}
}
+ #if !haxe3
function isType(v:String) {
var c0 = v.charCodeAt(0);
return c0 >= 'A'.code && c0 <= 'Z'.code;
}
+ #end
function map < T, R > ( a : Array, f : T -> R ) : Array {
var b = new Array();
@@ -127,12 +142,16 @@ class Macro {
case CInt(v): CInt(Std.string(v));
case CFloat(f): CFloat(Std.string(f));
case CString(s): CString(s);
+ #if !haxe3
case CInt32(v): CInt(Std.string(v));
+ #end
});
case EIdent(v):
+ #if !haxe3
if( isType(v) )
EConst(CType(v));
else
+ #end
EConst(CIdent(v));
case EVar(n, t, e):
EVars([ { name : n, expr : if( e == null ) null else convert(e), type : if( t == null ) null else convertType(t) } ]);
@@ -141,9 +160,11 @@ class Macro {
case EBlock(el):
EBlock(map(el,convert));
case EField(e, f):
+ #if !haxe3
if( isType(f) )
EType(convert(e), f);
else
+ #end
EField(convert(e), f);
case EBinop(op, e1, e2):
var b = binops.get(op);