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

Fix DCE for ArrayPatterns and ObjectPatterns #155

Merged
merged 1 commit into from
Sep 29, 2016

Conversation

boopathi
Copy link
Member

  • Bail out for replacement of single use variable inside a function

TODO (for later): maybe a more intelligent approach to replace - for ex,

// from
const [a] = b; return a;
const {a} = b; return a;

// to
return b[0];
return b.a;

+ Bail out for replacement of single use variable inside a function

TODO: maybe a more intelligent approach to replace - for ex,

// from
const [a] = b; return a;
const {a} = b; return a;

// to
return b[0];
return b.a;

+ (Close #151)
@loganfsmyth
Copy link
Member

const [a] = b; return a; isn't the same as b[0];, that'll break for Map and Set and such.

@boopathi
Copy link
Member Author

Yeah! Forgot about those. Thanks.

@boopathi
Copy link
Member Author

I think this PR is good to go to fix the bug. Will investigate later what other transformations can be applied.

@hzoo hzoo added the bug Confirmed bug label Sep 21, 2016
@kangax kangax merged commit 32c809b into master Sep 29, 2016
@kangax kangax deleted the fix-destructuring-pattern-0 branch September 29, 2016 20:55
boopathi added a commit that referenced this pull request Oct 30, 2016
Related previous fix - #155 does
the same thing except for a different case - the binding.constant is
true for that and for the current fix binding is not referenced but is
an array pattern or an object pattern.

+ (close #232)
hzoo pushed a commit that referenced this pull request Oct 30, 2016
Related previous fix - #155 does
the same thing except for a different case - the binding.constant is
true for that and for the current fix binding is not referenced but is
an array pattern or an object pattern.

+ (close #232)
kangax pushed a commit that referenced this pull request Nov 2, 2016
Related previous fix - #155 does
the same thing except for a different case - the binding.constant is
true for that and for the current fix binding is not referenced but is
an array pattern or an object pattern.

+ (close #232)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants