Don't transform method definition in transform-es2015-function-name (T6779)#3176
Merged
amasad merged 2 commits intobabel:masterfrom Dec 18, 2015
Merged
Don't transform method definition in transform-es2015-function-name (T6779)#3176amasad merged 2 commits intobabel:masterfrom
amasad merged 2 commits intobabel:masterfrom
Conversation
(Failing.)
Fix T6779. It should be possible to apply this to ES5 functions without mutating ES2015 MethodDefinition's.
Current coverage is
|
Member
|
Great, I understand this now ✋. Good job on the description. |
amasad
added a commit
that referenced
this pull request
Dec 18, 2015
Don't transform method definition in transform-es2015-function-name (T6779)
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.
See https://phabricator.babeljs.io/T6779. Supercedes #3149.
function-name=babel-plugin-transform-es2015-function-nameshorthand-properties=babel-plugin-transform-es2015-shorthand-propertiesCurrently
function-nametransforms method definition (e.g.{x () {}}) to function expression. That seems wrong.shorthand-propertiesalso performs that transformation and seems like the one that should be responsible for doing that and the one you should enable to opt-in to it. It seems like it should be possible to at the same time applyfunction-nameto anonymous function expressions and not transform method definitions.Example:
Input:
shorthand-propertiesOutput before and after PR:
function-nameOutput before PR:
Output after PR:
The current output of
function-namecan currently be achieved by using both transforms:Output before and after PR:
The old implementation visited
ObjectExpressionand loopedproperties. I guess that was more efficient when transforming bothObjectMethod|ObjectProperty. I changed it to visitObjectPropertydirectly.