-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
OS#14115684: Function-in-block semantics don't work for defer parse #4673
Merged
chakrabot
merged 1 commit into
chakra-core:release/1.8
from
boingoing:DeferFunctionInBlock
Feb 13, 2018
Merged
OS#14115684: Function-in-block semantics don't work for defer parse #4673
chakrabot
merged 1 commit into
chakra-core:release/1.8
from
boingoing:DeferFunctionInBlock
Feb 13, 2018
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In below code repro, we do not create var decl binding for `foo` inside the `nest` function in defer-parse mode. Due to this, we leave the reference to `foo` in `nest` on the pid ref stack and bind it to the formal `foo` parameter from the `test` function. This leads us to think formal `foo` is captured and try to put it into a scope slot. However, formal `foo` is not actually captured so no scope slot is allocated. When we actually generate bytecode for `test`, we hit a fail fast. ```js function test(foo) { function nest() { { function foo() { console.log('pass'); } } foo(); } nest(); } test(()=>console.log('fail')); ``` Fix is to create the var binding for `foo` at the function declaration for `foo` even in defer-parse mode. Fixes: https://microsoft.visualstudio.com/web/wi.aspx?id=14115684
boingoing
force-pushed
the
DeferFunctionInBlock
branch
from
February 13, 2018 01:23
8345462
to
c3d4e4d
Compare
@dotnet-bot test OSX static_osx_osx_debug please |
pleath
approved these changes
Feb 13, 2018
Thanks, Paul. |
chakrabot
pushed a commit
that referenced
this pull request
Feb 13, 2018
…'t work for defer parse Merge pull request #4673 from boingoing:DeferFunctionInBlock In below code repro, we do not create var decl binding for `foo` inside the `nest` function in defer-parse mode. Due to this, we leave the reference to `foo` in `nest` on the pid ref stack and bind it to the formal `foo` parameter from the `test` function. This leads us to think formal `foo` is captured and try to put it into a scope slot. However, formal `foo` is not actually captured so no scope slot is allocated. When we actually generate bytecode for `test`, we hit a fail fast. ```js function test(foo) { function nest() { { function foo() { console.log('pass'); } } foo(); } nest(); } test(()=>console.log('fail')); ``` Fix is to create the var binding for `foo` at the function declaration for `foo` even in defer-parse mode. Fixes: https://microsoft.visualstudio.com/web/wi.aspx?id=14115684
chakrabot
pushed a commit
that referenced
this pull request
Feb 13, 2018
…antics don't work for defer parse Merge pull request #4673 from boingoing:DeferFunctionInBlock In below code repro, we do not create var decl binding for `foo` inside the `nest` function in defer-parse mode. Due to this, we leave the reference to `foo` in `nest` on the pid ref stack and bind it to the formal `foo` parameter from the `test` function. This leads us to think formal `foo` is captured and try to put it into a scope slot. However, formal `foo` is not actually captured so no scope slot is allocated. When we actually generate bytecode for `test`, we hit a fail fast. ```js function test(foo) { function nest() { { function foo() { console.log('pass'); } } foo(); } nest(); } test(()=>console.log('fail')); ``` Fix is to create the var binding for `foo` at the function declaration for `foo` even in defer-parse mode. Fixes: https://microsoft.visualstudio.com/web/wi.aspx?id=14115684
chakrabot
pushed a commit
that referenced
this pull request
Feb 13, 2018
…-in-block semantics don't work for defer parse Merge pull request #4673 from boingoing:DeferFunctionInBlock In below code repro, we do not create var decl binding for `foo` inside the `nest` function in defer-parse mode. Due to this, we leave the reference to `foo` in `nest` on the pid ref stack and bind it to the formal `foo` parameter from the `test` function. This leads us to think formal `foo` is captured and try to put it into a scope slot. However, formal `foo` is not actually captured so no scope slot is allocated. When we actually generate bytecode for `test`, we hit a fail fast. ```js function test(foo) { function nest() { { function foo() { console.log('pass'); } } foo(); } nest(); } test(()=>console.log('fail')); ``` Fix is to create the var binding for `foo` at the function declaration for `foo` even in defer-parse mode. Fixes: https://microsoft.visualstudio.com/web/wi.aspx?id=14115684
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In below code repro, we do not create var decl binding for
foo
inside thenest
function in defer-parse mode. Due to this, we leave the reference tofoo
innest
on the pid ref stack and bind it to the formalfoo
parameter from thetest
function. This leads us to think formalfoo
is captured and try to put it into a scope slot. However, formalfoo
is not actually captured so no scope slot is allocated. When we actually generate bytecode fortest
, we hit a fail fast.Fix is to create the var binding for
foo
at the function declaration forfoo
even in defer-parse mode.Fixes:
https://microsoft.visualstudio.com/web/wi.aspx?id=14115684