Closed GoogleCodeExporter closed 9 years ago
I'm using a workaround below, break some other cases (empty json object) however
--- 1,5,2/hscript/Parser.hx 2011-02-22 20:43:28.000000000 +0800
+++ 1,5,2,1/hscript/Parser.hx 2011-02-22 20:49:23.000000000 +0800
@@ -195,7 +195,7 @@
tk = token();
switch( tk ) {
case TBrClose:
- return parseExprNext(EObject([]));
+ return parseExprNext(EBlock([]));
case TId(id):
var tk2 = token();
tokens.add(tk2);
Original comment by freewiz...@gmail.com
on 22 Feb 2011 at 1:40
This issue was closed by revision r35.
Original comment by ncanna...@gmail.com
on 24 Feb 2011 at 6:58
Nicolas, I suppose the test case and expect result should be:
test("(function(){})()", null);
My workaround in Interp.hx in addition to r35:
case EFunction(params,fexpr,name):
var capturedLocals = duplicate(locals);
var me = this;
var f = function(args:Array<Dynamic>) {
if( args.length != params.length ) throw "Invalid number of parameters";
var old = me.locals;
me.locals = me.duplicate(capturedLocals);
for( i in 0...params.length )
me.locals.set(params[i],{ r : args[i] });
var r = null;
try {
- r = me.exprReturn(fexpr);
+ switch(fexpr) {
+ case EObject(v): r = (0==v.length) ? null : me.exprReturn(fexpr);
+ default: r = me.exprReturn(fexpr);
+ }
} catch( e : Dynamic ) {
Original comment by freewiz...@gmail.com
on 24 Feb 2011 at 7:39
Original issue reported on code.google.com by
freewiz...@gmail.com
on 21 Feb 2011 at 1:45