higgsjs / Higgs

Higgs JavaScript Virtual Machine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sunspider string-validate-input segfaults

mollymorphic opened this issue · comments

The sunspider benchmark string-validate-input.js currently segfaults when run.

The issue is on line 16:

(k%2)?email=name+"@mac.com":email=name+"(at)mac.com";

If you have such a construct in the top level like so:

var k = 0;
(k%2)?email=name+"@mac.com":email=name+"(at)mac.com";

...you will (incorrectly) get a parse error:
parse error: "../bin/snspdrfail.js"@2:2: invalid lhs in assignment

If it's placed inside a function:

var k = 0;
function foo()
{
    (k%2)?email=name+"@mac.com":email=name+"(at)mac.com";
}
foo();

...Higgs will segfault at the function call.

Ok, I'll take a look at this tonight. Seems like a bug in the AST->IR. Could also be that the ternary expression isn't parsing right, produces the wrong AST. Thanks for looking into this.

Bug fixed. Added a quick-running version of the benchmark to make test as well. Victory.