X-Git-Url: http://git.megacz.com/?p=org.ibex.js.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fjs%2FInterpreter.java;fp=src%2Forg%2Fibex%2Fjs%2FInterpreter.java;h=21fffbad2a238466832e314ca956b10e12c8883a;hp=77da0aba07e0ba00112163b334e898cdc11ad0f7;hb=588dbfe300e32f4b6d98aa83c52381ce1a52799f;hpb=afd68d3ee0692ed79304b84e496c87406c5aaf4f diff --git a/src/org/ibex/js/Interpreter.java b/src/org/ibex/js/Interpreter.java index 77da0ab..21fffba 100644 --- a/src/org/ibex/js/Interpreter.java +++ b/src/org/ibex/js/Interpreter.java @@ -371,8 +371,8 @@ class Interpreter implements ByteCodes, Tokens, Pausable { if (object instanceof JSFunction) { stack.push(new CallMarker(this)); - stack.push(jsargs); f = (JSFunction)object; + stack.push(new JSArgs(jsargs, f)); scope = f.parentScope; pc = -1; break; @@ -610,7 +610,10 @@ class Interpreter implements ByteCodes, Tokens, Pausable { public JSArgs(JS[] args, JS callee) { this.args = args; this.callee = callee; } public JS get(JS key) throws JSExn { - if(JSU.isInt(key)) return args[JSU.toInt(key)]; + if(JSU.isInt(key)) { + int i = JSU.toInt(key); + return i>=args.length ? null : args[i]; + } //#switch(JSU.toString(key)) case "callee": return callee; case "length": return JSU.N(args.length);