You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Platform: Darwin Princes-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Aug 29 20:21:34 PDT 2016; root:xnu-3248.60.11~1/RELEASE_X86_64 x86_64
While working on #8195, I come across this v8 issue.
// with vm & replconstvm=require('vm');constscript=vm.createScript("{ a: 1 } { a: 1 }",{displayErrors: true});constoutput=script.runInThisContext({displayErrors: true});console.log(output);// returns 1 instead of throwing syntax error// when used directly{ a: 1}{a: 1}// no error// when used with other constructsconsole.log({a: 1}{a: 1})// Throws SyntaxError: missing ) after argument list
Chrome behaviour
Canary (64-bit)(55.0.2856.0) is buggy where as the latest version (52.0.2743.116) works fine.
cc: @nodejs/v8
The text was updated successfully, but these errors were encountered:
I think this is expected behaviour… V8 interprets the {} as code blocks and the a: as labels (MDN), i.e. as:
{
a:
1;
}
{
a:
1;
}
That’s valid, even if not very meaningful, JS code. You can’t put arbitrary code blocks as function parameters, so V8 is right to complain about the console.log example.
@addaleax so the last chrome browser(v52.0.2743.116) is buggy and the canary has correct behaviour. right? Feel free to close it if you are sure about it 👍
edit: Firefox is also having same behaviour, seems legit.
v8
(version tested:5.1.281.81
&5.1.281.82
) (vm
&repl
modules are affected)While working on #8195, I come across this v8 issue.
Chrome behaviour
Canary (64-bit)
(55.0.2856.0) is buggy where as the latest version (52.0.2743.116) works fine.cc: @nodejs/v8
The text was updated successfully, but these errors were encountered: