This repository has been archived by the owner on May 19, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 258
Fix several issues with class properties (#157, #116) #158
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ca66f6b
Avoid ASI between "get"/"set" and method name (#157)
motiz88 394b6a1
Merge remote-tracking branch 'upstream/master' into fix-157
motiz88 7e297a4
Distinguish methods from properties correctly when newlines are involved
motiz88 a146ebc
Add regression test for #116
motiz88 be3a4ec
Support class properties not followed by newline
motiz88 a5599a4
Merge remote-tracking branch 'upstream/master' into fix-157
motiz88 6066a4c
Fix more class property/method edge cases
motiz88 b98f428
Don't emit ClassProperty nodes without classProperties plugin
motiz88 0bc9a84
Allow uninitialized class properties in Flow code without "classPrope…
motiz88 c51fb67
Test for specific errors when missing classProperties plugin
motiz88 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
1 change: 1 addition & 0 deletions
1
test/fixtures/experimental/class-properties/at-end-async/actual.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class A { async } |
119 changes: 119 additions & 0 deletions
119
test/fixtures/experimental/class-properties/at-end-async/expected.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
{ | ||
"type": "File", | ||
"start": 0, | ||
"end": 17, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 17 | ||
} | ||
}, | ||
"program": { | ||
"type": "Program", | ||
"start": 0, | ||
"end": 17, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 17 | ||
} | ||
}, | ||
"sourceType": "script", | ||
"body": [ | ||
{ | ||
"type": "ClassDeclaration", | ||
"start": 0, | ||
"end": 17, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 17 | ||
} | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 6, | ||
"end": 7, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 6 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 7 | ||
}, | ||
"identifierName": "A" | ||
}, | ||
"name": "A" | ||
}, | ||
"superClass": null, | ||
"body": { | ||
"type": "ClassBody", | ||
"start": 8, | ||
"end": 17, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 8 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 17 | ||
} | ||
}, | ||
"body": [ | ||
{ | ||
"type": "ClassProperty", | ||
"start": 10, | ||
"end": 15, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 10 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 15 | ||
} | ||
}, | ||
"computed": false, | ||
"key": { | ||
"type": "Identifier", | ||
"start": 10, | ||
"end": 15, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 10 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 15 | ||
}, | ||
"identifierName": "async" | ||
}, | ||
"name": "async" | ||
}, | ||
"static": false, | ||
"value": null | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
test/fixtures/experimental/class-properties/at-end-computed/actual.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class A { [Symbol.foo] } |
152 changes: 152 additions & 0 deletions
152
test/fixtures/experimental/class-properties/at-end-computed/expected.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
{ | ||
"type": "File", | ||
"start": 0, | ||
"end": 24, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 24 | ||
} | ||
}, | ||
"program": { | ||
"type": "Program", | ||
"start": 0, | ||
"end": 24, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 24 | ||
} | ||
}, | ||
"sourceType": "script", | ||
"body": [ | ||
{ | ||
"type": "ClassDeclaration", | ||
"start": 0, | ||
"end": 24, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 24 | ||
} | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 6, | ||
"end": 7, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 6 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 7 | ||
}, | ||
"identifierName": "A" | ||
}, | ||
"name": "A" | ||
}, | ||
"superClass": null, | ||
"body": { | ||
"type": "ClassBody", | ||
"start": 8, | ||
"end": 24, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 8 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 24 | ||
} | ||
}, | ||
"body": [ | ||
{ | ||
"type": "ClassProperty", | ||
"start": 10, | ||
"end": 22, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 10 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 22 | ||
} | ||
}, | ||
"computed": true, | ||
"key": { | ||
"type": "MemberExpression", | ||
"start": 11, | ||
"end": 21, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 11 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 21 | ||
} | ||
}, | ||
"object": { | ||
"type": "Identifier", | ||
"start": 11, | ||
"end": 17, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 11 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 17 | ||
}, | ||
"identifierName": "Symbol" | ||
}, | ||
"name": "Symbol" | ||
}, | ||
"property": { | ||
"type": "Identifier", | ||
"start": 18, | ||
"end": 21, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 18 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 21 | ||
}, | ||
"identifierName": "foo" | ||
}, | ||
"name": "foo" | ||
}, | ||
"computed": false | ||
}, | ||
"static": false, | ||
"value": null | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
test/fixtures/experimental/class-properties/at-end-get/actual.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class A { get } |
Oops, something went wrong.
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.
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.
I am not involved in the project, so take this with a grain of salt, but nested
if
s like this look strange to me - why not combine the two conditions?