DescriptionImplement sloppy-mode block-defined functions (Annex B 3.3)
ES2015 specifies very particular semantics for functions defined in blocks.
In strict mode, it is simply a lexical binding scoped to that block. In sloppy
mode, in addition to that lexical binding, there is a var-style binding in
the outer scope, which is overwritten with the local binding when the function
declaration is evaluated, *as long as* introducing ths var binding would not
create a var/let conflict in the outer scope.
This patch implements the semantics by introducing a DelegateStatement, which
is initially filled in with the EmptyStatement and overwritten with the
assignment when the scope is closed out and it can be checked that there is
no conflict.
This patch is tested with a new mjsunit test, and I tried staging it and running
test262, finding that the tests that we have disabled due to lack of Annex B
support now pass.
R=adamk,rossberg
LOG=Y
BUG=v8:4285
Committed: https://crrev.com/e5ff10d7673a723b1b62b1ddfca194265aaff84c
Cr-Commit-Position: refs/heads/master@{#30842}
Patch Set 1 #Patch Set 2 : Tests. It works! #Patch Set 3 : Remove DelegateStatement linked list #Patch Set 4 : Fixing test which was broken with Annex B #Patch Set 5 : An extra test and comment fix #
Total comments: 41
Patch Set 6 : Fix comments, except for better testing #Patch Set 7 : More tests #
Total comments: 4
Patch Set 8 : rest parameter test #Patch Set 9 : Naming #
Total comments: 2
Patch Set 10 : Improve type clarity #
Messages
Total messages: 36 (13 generated)
|