-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Function declaration throws in REPL #10950
Comments
So, I get these results on > function f(){} f()
var f = function f(){} f()
^
SyntaxError: Unexpected identifier
> var f = function f(){} f()
var f = function f(){} f()
^
SyntaxError: Unexpected identifier
> function f(){}, a=9
undefined
> a
9
> To me, I think all variations of Note: I'm no spec expert on what is and isn't valid. |
It's caused by bb9eabe, which is a fix/workaround for #548 and scheduled to be removed when we upgrade to V8 5.5, see #9618. I don't think we'll be able to fix this in in v7.x and older without reintroducing the issue that bb9eabe was supposed to address. EDIT: For posterity: bb9eabe is from #7624; the commit log is missing the PR-URL tag. |
This is fixed on master now. |
Closing according to #10950 (comment), feel free to reopen if the issue persists |
The following code is executed normally from a file, but throws from REPL.
I guess the function declaration is converted to function expression which unlike the declaration requires semicolon. However, everything works fine with
5; function f(){} f()
.Also, this code works in REPL:
function f(){}, a=9
, but it shouldn't.The text was updated successfully, but these errors were encountered: