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
Make special case for class property initializers in shadow-functions
#4502
Merged
hzoo
merged 1 commit into
babel:master
from
motiz88:class-property-initializer-blocks-shadow
Oct 14, 2016
Merged
Make special case for class property initializers in shadow-functions
#4502
hzoo
merged 1 commit into
babel:master
from
motiz88:class-property-initializer-blocks-shadow
Oct 14, 2016
Conversation
This file contains 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
Current coverage is 88.74% (diff: 100%)@@ master #4502 diff @@
==========================================
Files 195 195
Lines 13773 13776 +3
Methods 1425 1425
Messages 0 0
Branches 3171 3173 +2
==========================================
+ Hits 12223 12226 +3
Misses 1550 1550
Partials 0 0
|
This was referenced Sep 12, 2016
loganfsmyth
reviewed
Sep 25, 2016
if (path.parentPath && path.parentPath.isClassProperty() && path.key === "value") { | ||
return true; | ||
} | ||
if (first) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than using this flag, which took me a minute to process, could we perhaps do
let fnPath = path.find(function (innerPath) { // rename argument
if (innerPath.parentPath && innerPath.parentPath.isClassProperty() && innerPath.key === "value") {
return true;
}
if (path === innerPath) return false;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
motiz88
force-pushed
the
class-property-initializer-blocks-shadow
branch
from
October 1, 2016 12:44
b2a61fb
to
545b966
Compare
danez
approved these changes
Oct 14, 2016
hzoo
added
the
PR: Bug Fix 🐛
A type of pull request used for our changelog categories
label
Oct 14, 2016
chrisprice
pushed a commit
to chrisprice/babel
that referenced
this pull request
Oct 18, 2016
panagosg7
pushed a commit
to panagosg7/babel
that referenced
this pull request
Jan 17, 2017
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
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
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.
This modifies
shadow-functions
to leave references tothis
andarguments
unmodified in the context of a class property'svalue
expression. The effect is akin to introducing an implicit scope around each such initializer, and is in line with the current proposal AFAICT.All this applies only when emitting code with the class properties syntax and not running it through
transform-class-properties
- which is the only way such syntax can reachshadow-functions
. The transform itself is correct and unchanged.