Fix shorthand properties for non-es6 module formats#7442
Merged
RyanCavanaugh merged 3 commits intoMar 9, 2016
Conversation
|
Hi @Victorystick, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
Member
|
To add a testcase:
|
Author
|
@RyanCavanaugh Is that alright? |
Member
|
Yep, that looks right |
Contributor
|
👍 |
RyanCavanaugh
added a commit
that referenced
this pull request
Mar 9, 2016
Fix shorthand properties for non-es6 module formats
Member
|
Thanks! |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Shorthand properties like
{ x }are currently expanded to{ x: x }when using any module format other than ES6. This PR changes this to apply to an ES6+ script target instead.The special cases considered now also includes whether the current module format has direct or indirect access to imported identifiers. The ES6
and Systemformats for example have direct access, all others have indirect access. This means that the shorthand properties must be expanded, even for ES6+ script targets if the identifier is indirectly imported.For example, the object expression in code below can be preserved as is when targeting ES6+ with an ES6
or Systemmodule format.Update: After discovering that TypeScript doesn't generate direct identifier accesses for the System module format, the changes now only affects ES6 modules.
but is expanded for all other formats.
Fixes #7434