Skip to content
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

FunctionDeclaration shouldn't be BlockScoped #10050

Draft
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
1 participant
@mischnic
Copy link

commented May 31, 2019

Q                       A
Fixed Issues? Fixes #10046
Patch: Bug Fix? Yes
Major: Breaking Change? Unclear
Minor: New Feature? No
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes? No
License MIT

WIP, this breaks some tests, but fixes the problems described below

Code sample:

if(true) {
  function run() {
    return true;
  }
}

function test() {
  return run();
}

This should fix:

  • @babel/plugin-transform-block-scoping renames run to a new unique name
  • run isn't a binding in the babel-traverse's program.scope

mischnic added some commits May 31, 2019

Fix a scope test
old: `const foo;{function foo() {}}`
new: `const foo = 2;{function foo() {}}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.