Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upLegacy hoisting for `function arguments() {}` still not correct? #991
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
anba
Sep 6, 2017
Contributor
This test from test262 also asserts the wrong thing:
https://github.com/tc39/test262/blob/443b15e43e8c497b2edcf8c064b11fd7c1ad67fc/test/annexB/language/function-code/block-decl-func-skip-arguments.js#L34
|
This test from test262 also asserts the wrong thing: |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
cc @rwaldron ^^ |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
littledan
Sep 13, 2017
Member
I'm not so happy with how complicated it turns out to support legacy hosting of functions named argument. Maybe we should just consistently skip this hoisting, as I guess were the semantics at some point recently.
|
I'm not so happy with how complicated it turns out to support legacy hosting of functions named |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
allenwb
Sep 13, 2017
Member
@littledan
I'm with you. Legacy FiB supports solely to not break existing code that is interoperable among major browsers. If there is evidence that not hoisting functions named arguments does not result in significant breakage then we should add it the complexity. The rules for binding arguments is already too complicated.
|
@littledan |
anba commentedSep 6, 2017
refs: #815, #889, #891
Per the current spec semantics:
Explanation:
function arguments() {}is an applicable legacy block-scoped function, because it can be replaced withvar argumentswithout causing an early SyntaxError, andargumentsis not a parameter name (B.3.3.1 Changes to FunctionDeclarationInstantiation, step 1.a.ii).varEnvRec, because the function name is "arguments".varEnvRec.fenvRecdoesn't have a binding for "arguments".Maybe we just need something like this in B.3.3.1:
And two nits in B.3.3.1 Changes to FunctionDeclarationInstantiation:
initializedBindings->instantiatedVarNames.