bugfix when exception in function

This commit is contained in:
Nicolas Cannasse
2008-09-07 15:11:26 +00:00
parent 9b9f6f3432
commit 75168c7f57
3 changed files with 9 additions and 2 deletions
+1
View File
@@ -56,6 +56,7 @@ class Test {
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 : IntIter });
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);
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
<project name="hscript" url="http://haxe.org/com/libs/hscript" license="GPL">
<user name="ncannasse"/>
<description>haXe Script is a scripting engine for a subset of the haXe language</description>
<version name="1.4">Added new, throw, try/catch, hex numbers and ... operator support</version>
<version name="1.4.1">Fixed bug in interpreter when catching exception in function</version>
</project>
+7 -1
View File
@@ -283,7 +283,13 @@ class Interp {
me.locals = me.duplicate(capturedLocals);
for( i in 0...params.length )
me.locals.set(params[i],{ r : args[i] });
var r = me.exprReturn(fexpr);
var r;
try {
r = me.exprReturn(fexpr);
} catch( e : Dynamic ) {
me.locals = old;
throw e;
}
me.locals = old;
return r;
};