Skip to content

Fix invalid block-scoped loop - #6046

Merged
hzoo merged 2 commits into
babel:7.0from
jridgewell:pr/6038
Aug 3, 2017
Merged

hzoo merged 2 commits into
babel:7.0from
jridgewell:pr/6038

Conversation

@jridgewell

Copy link
Copy Markdown
Member
Q A
Patch: Bug Fix? Yes
Major: Breaking Change? No
Minor: New Feature? No
Deprecations? No
Spec Compliancy? Yes?
Tests Added/Pass? Yes
Fixed Tickets Closes #6038
License MIT
Doc PR
Dependency Changes

The issue is we're reusing the same identifier in two scopes (in as the hoisted loop's function params, and as that function's call expression arguments). Well, when we remap in the context of the loop call, we changed the param's name, too.

@jridgewell jridgewell added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Aug 2, 2017
@mention-bot

Copy link
Copy Markdown

@jridgewell, thanks for your PR! By analyzing the history of the files in this pull request, we identified @hzoo, @existentialism and @loganfsmyth to be potential reviewers.

// turn outsideLetReferences into an array
const params = values(outsideRefs);
const args = values(outsideRefs);
const params = args.map(id => t.clone(id));

@hzoo hzoo Aug 3, 2017 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering, are there other places we would need to make this change (where we don't clone)? and how we can prevent this issue in the future (other than the whole immutable ast)

@hzoo

hzoo commented Aug 3, 2017

Copy link
Copy Markdown
Member

Awesome fix!

@hzoo
hzoo merged commit 6630ae9 into babel:7.0 Aug 3, 2017
@lock lock Bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 6, 2019
@lock lock Bot locked as resolved and limited conversation to collaborators Oct 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants