Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't fail for object decorators with stage 2
- Loading branch information
1 parent
43f7bcd
commit 9f985e0
Showing
3 changed files
with
202 additions
and
8 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,5 @@ | |
"decoratorsBeforeExport": false | ||
} | ||
] | ||
], | ||
"throws": "Unexpected token (2:2)" | ||
] | ||
} |
195 changes: 195 additions & 0 deletions
195
packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/output.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,195 @@ | ||
{ | ||
"type": "File", | ||
"start": 0, | ||
"end": 32, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 5, | ||
"column": 1 | ||
} | ||
}, | ||
"errors": [ | ||
"SyntaxError: Stage 2 decorators disallow object literal property decorators (2:2)" | ||
], | ||
"program": { | ||
"type": "Program", | ||
"start": 0, | ||
"end": 32, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 5, | ||
"column": 1 | ||
} | ||
}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "VariableDeclaration", | ||
"start": 0, | ||
"end": 32, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 5, | ||
"column": 1 | ||
} | ||
}, | ||
"declarations": [ | ||
{ | ||
"type": "VariableDeclarator", | ||
"start": 4, | ||
"end": 32, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 4 | ||
}, | ||
"end": { | ||
"line": 5, | ||
"column": 1 | ||
} | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 4, | ||
"end": 5, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 4 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 5 | ||
}, | ||
"identifierName": "o" | ||
}, | ||
"name": "o" | ||
}, | ||
"init": { | ||
"type": "ObjectExpression", | ||
"start": 8, | ||
"end": 32, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 8 | ||
}, | ||
"end": { | ||
"line": 5, | ||
"column": 1 | ||
} | ||
}, | ||
"properties": [ | ||
{ | ||
"type": "ObjectMethod", | ||
"start": 19, | ||
"end": 30, | ||
"loc": { | ||
"start": { | ||
"line": 3, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 4, | ||
"column": 3 | ||
} | ||
}, | ||
"decorators": [ | ||
{ | ||
"type": "Decorator", | ||
"start": 12, | ||
"end": 16, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 6 | ||
} | ||
}, | ||
"expression": { | ||
"type": "Identifier", | ||
"start": 13, | ||
"end": 16, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 3 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 6 | ||
}, | ||
"identifierName": "baz" | ||
}, | ||
"name": "baz" | ||
} | ||
} | ||
], | ||
"method": true, | ||
"key": { | ||
"type": "Identifier", | ||
"start": 19, | ||
"end": 22, | ||
"loc": { | ||
"start": { | ||
"line": 3, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 5 | ||
}, | ||
"identifierName": "foo" | ||
}, | ||
"name": "foo" | ||
}, | ||
"computed": false, | ||
"kind": "method", | ||
"id": null, | ||
"generator": false, | ||
"async": false, | ||
"params": [], | ||
"body": { | ||
"type": "BlockStatement", | ||
"start": 25, | ||
"end": 30, | ||
"loc": { | ||
"start": { | ||
"line": 3, | ||
"column": 8 | ||
}, | ||
"end": { | ||
"line": 4, | ||
"column": 3 | ||
} | ||
}, | ||
"body": [], | ||
"directives": [] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"kind": "var" | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |