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
Decorators Stage 2 Parsing #587
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
06afa07
Update decorator parsing to match current spec
bakkot a24dc6e
Let decorator stage 2 parsing be under a new plugin name
peey 001044f
Add tests for stage 2 decorators from PR#353
peey 162bc90
Throw if both decorators decorators-stage-2 used
peey 9c63974
Disallow in object literals, params, class props
peey b5e2383
Disallow exports between decorator & class body
peey 38c417e
Reorganize tests; camelCase plugin name
peey b7c1c55
Add test case for object properties
peey 4f8ac6b
Merge branch 'master' into decorators-stage-2
peey b60ac52
Reorganize tests and add tests
peey 04b4086
Add more tests; fix plugin conflict code
peey e1972ba
Decorated classes/methods start where the decorator starts
peey e5fdb34
rename decoratorsStage2 -> decorators2
peey d99618c
renames files
peey 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
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
2 changes: 2 additions & 0 deletions
2
test/fixtures/experimental/decorators-2/class-decorator-call-expr/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,2 @@ | ||
@foo('bar') | ||
class Foo {} |
154 changes: 154 additions & 0 deletions
154
test/fixtures/experimental/decorators-2/class-decorator-call-expr/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,154 @@ | ||
{ | ||
"type": "File", | ||
"start": 0, | ||
"end": 24, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 12 | ||
} | ||
}, | ||
"program": { | ||
"type": "Program", | ||
"start": 0, | ||
"end": 24, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 12 | ||
} | ||
}, | ||
"sourceType": "script", | ||
"body": [ | ||
{ | ||
"type": "ClassDeclaration", | ||
"start": 0, | ||
"end": 24, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 12 | ||
} | ||
}, | ||
"decorators": [ | ||
{ | ||
"type": "Decorator", | ||
"start": 0, | ||
"end": 11, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 11 | ||
} | ||
}, | ||
"expression": { | ||
"type": "CallExpression", | ||
"start": 1, | ||
"end": 11, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 1 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 11 | ||
} | ||
}, | ||
"callee": { | ||
"type": "Identifier", | ||
"start": 1, | ||
"end": 4, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 1 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 4 | ||
}, | ||
"identifierName": "foo" | ||
}, | ||
"name": "foo" | ||
}, | ||
"arguments": [ | ||
{ | ||
"type": "StringLiteral", | ||
"start": 5, | ||
"end": 10, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 5 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 10 | ||
} | ||
}, | ||
"extra": { | ||
"rawValue": "bar", | ||
"raw": "'bar'" | ||
}, | ||
"value": "bar" | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"id": { | ||
"type": "Identifier", | ||
"start": 18, | ||
"end": 21, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 6 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 9 | ||
}, | ||
"identifierName": "Foo" | ||
}, | ||
"name": "Foo" | ||
}, | ||
"superClass": null, | ||
"body": { | ||
"type": "ClassBody", | ||
"start": 22, | ||
"end": 24, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 10 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 12 | ||
} | ||
}, | ||
"body": [] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
test/fixtures/experimental/decorators-2/class-decorator/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,4 @@ | ||
@abc | ||
class Foo { | ||
|
||
} |
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'd say to use
Array.prototype.includes
instead...... but that doesn't work on Node 4 😢