haxe3 update
This commit is contained in:
@@ -17,14 +17,12 @@ class Test {
|
|||||||
test("0",0);
|
test("0",0);
|
||||||
test("0xFF", 255);
|
test("0xFF", 255);
|
||||||
#if haxe3
|
#if haxe3
|
||||||
test("n(0xBFFFFFFF)",0xBFFFFFFF);
|
test("0xBFFFFFFF",0xBFFFFFFF);
|
||||||
test("n(0x7FFFFFFF)", 0x7FFFFFFF);
|
test("0x7FFFFFFF", 0x7FFFFFFF);
|
||||||
#else
|
#elseif !neko
|
||||||
#if !neko
|
|
||||||
test("n(0xBFFFFFFF)",0xBFFFFFFF,{ n : haxe.Int32.toNativeInt });
|
test("n(0xBFFFFFFF)",0xBFFFFFFF,{ n : haxe.Int32.toNativeInt });
|
||||||
test("n(0x7FFFFFFF)", 0x7FFFFFFF, { n : haxe.Int32.toNativeInt } );
|
test("n(0x7FFFFFFF)", 0x7FFFFFFF, { n : haxe.Int32.toNativeInt } );
|
||||||
#end
|
#end
|
||||||
#end
|
|
||||||
test("-123",-123);
|
test("-123",-123);
|
||||||
test("- 123",-123);
|
test("- 123",-123);
|
||||||
test("1.546",1.546);
|
test("1.546",1.546);
|
||||||
@@ -70,8 +68,12 @@ class Test {
|
|||||||
test("(function(a,b) return a + b)(4,5)",9);
|
test("(function(a,b) return a + b)(4,5)",9);
|
||||||
test("var y = 0; var add = function(a) y += a; add(5); add(3); y", 8);
|
test("var y = 0; var add = function(a) y += a; add(5); add(3); y", 8);
|
||||||
test("var a = [1,[2,[3,[4,null]]]]; var t = 0; while( a != null ) { t += a[0]; a = a[1]; }; t",10);
|
test("var a = [1,[2,[3,[4,null]]]]; var t = 0; while( a != null ) { t += a[0]; a = a[1]; }; t",10);
|
||||||
test("var t = 0; for( x in 1...10 ) t += x; t",45);
|
test("var t = 0; for( x in 1...10 ) t += x; t", 45);
|
||||||
test("var t = 0; for( x in new IntIter(1,10) ) t +=x; t",45,{ IntIter : #if (haxe3 || haxe_211) IntIterator #else IntIter #end });
|
#if haxe3
|
||||||
|
test("var t = 0; for( x in new IntIterator(1,10) ) t +=x; t", 45);
|
||||||
|
#else
|
||||||
|
test("var t = 0; for( x in new IntIter(1,10) ) t +=x; t", 45);
|
||||||
|
#end
|
||||||
test("var x = 1; try { var x = 66; throw 789; } catch( e : Dynamic ) e + x",790);
|
test("var x = 1; try { var x = 66; throw 789; } catch( e : Dynamic ) e + x",790);
|
||||||
test("var x = 1; var f = function(x) throw x; try f(55) catch( e : Dynamic ) e + x",56);
|
test("var x = 1; var f = function(x) throw x; try f(55) catch( e : Dynamic ) e + x",56);
|
||||||
test("var i=2; if( true ) --i; i",1);
|
test("var i=2; if( true ) --i; i",1);
|
||||||
|
|||||||
@@ -3,3 +3,4 @@
|
|||||||
--flash-strict
|
--flash-strict
|
||||||
-swf-version 9
|
-swf-version 9
|
||||||
-main Test
|
-main Test
|
||||||
|
-dce no
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@
|
|||||||
<option flashStrict="True" />
|
<option flashStrict="True" />
|
||||||
<option mainClass="Test" />
|
<option mainClass="Test" />
|
||||||
<option enabledebug="False" />
|
<option enabledebug="False" />
|
||||||
<option additional="" />
|
<option additional="-dce no" />
|
||||||
</build>
|
</build>
|
||||||
<!-- haxelib libraries -->
|
<!-- haxelib libraries -->
|
||||||
<haxelib>
|
<haxelib>
|
||||||
|
|||||||
+14
-8
@@ -225,6 +225,16 @@ class Interp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resolve( id : String ) : Dynamic {
|
||||||
|
var l = locals.get(id);
|
||||||
|
if( l != null )
|
||||||
|
return l.r;
|
||||||
|
var v = variables.get(id);
|
||||||
|
if( v == null && !variables.exists(id) )
|
||||||
|
throw Error.EUnknownVariable(id);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
public function expr( e : Expr ) : Dynamic {
|
public function expr( e : Expr ) : Dynamic {
|
||||||
switch( e ) {
|
switch( e ) {
|
||||||
case EConst(c):
|
case EConst(c):
|
||||||
@@ -237,13 +247,7 @@ class Interp {
|
|||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
case EIdent(id):
|
case EIdent(id):
|
||||||
var l = locals.get(id);
|
return resolve(id);
|
||||||
if( l != null )
|
|
||||||
return l.r;
|
|
||||||
var v = variables.get(id);
|
|
||||||
if( v == null && !variables.exists(id) )
|
|
||||||
throw Error.EUnknownVariable(id);
|
|
||||||
return v;
|
|
||||||
case EVar(n,_,e):
|
case EVar(n,_,e):
|
||||||
declared.push({ n : n, old : locals.get(n) });
|
declared.push({ n : n, old : locals.get(n) });
|
||||||
locals.set(n,{ r : (e == null)?null:expr(e) });
|
locals.set(n,{ r : (e == null)?null:expr(e) });
|
||||||
@@ -439,7 +443,9 @@ class Interp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cnew( cl : String, args : Array<Dynamic> ) : Dynamic {
|
function cnew( cl : String, args : Array<Dynamic> ) : Dynamic {
|
||||||
return Type.createInstance(Type.resolveClass(cl),args);
|
var c = Type.resolveClass(cl);
|
||||||
|
if( c == null ) c = resolve(cl);
|
||||||
|
return Type.createInstance(c,args);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user