Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c22c24
commit 4f9033c
Showing
2 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
packages/babel-parser/test/fixtures/typescript/class/invalid-modifiers-order/input.ts
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,6 @@ | ||
class Foo extends Bar { | ||
override private foo1: string | ||
readonly private foo2: string; | ||
readonly private override foo3: string; | ||
private readonly override foo4: string; | ||
} |
130 changes: 130 additions & 0 deletions
130
packages/babel-parser/test/fixtures/typescript/class/invalid-modifiers-order/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,130 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":174,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, | ||
"errors": [ | ||
"SyntaxError: 'private' modifier must precede 'override' modifier. (2:11)", | ||
"SyntaxError: 'private' modifier must precede 'readonly' modifier. (3:11)", | ||
"SyntaxError: 'private' modifier must precede 'readonly' modifier. (4:11)", | ||
"SyntaxError: 'override' modifier must precede 'readonly' modifier. (4:19)", | ||
"SyntaxError: 'override' modifier must precede 'readonly' modifier. (5:19)" | ||
], | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":174,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "ClassDeclaration", | ||
"start":0,"end":174,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, | ||
"id": { | ||
"type": "Identifier", | ||
"start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, | ||
"name": "Foo" | ||
}, | ||
"superClass": { | ||
"type": "Identifier", | ||
"start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"Bar"}, | ||
"name": "Bar" | ||
}, | ||
"body": { | ||
"type": "ClassBody", | ||
"start":22,"end":174,"loc":{"start":{"line":1,"column":22},"end":{"line":6,"column":1}}, | ||
"body": [ | ||
{ | ||
"type": "ClassProperty", | ||
"start":26,"end":55,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":31}}, | ||
"override": true, | ||
"accessibility": "private", | ||
"static": false, | ||
"key": { | ||
"type": "Identifier", | ||
"start":43,"end":47,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":23},"identifierName":"foo1"}, | ||
"name": "foo1" | ||
}, | ||
"computed": false, | ||
"typeAnnotation": { | ||
"type": "TSTypeAnnotation", | ||
"start":47,"end":55,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":31}}, | ||
"typeAnnotation": { | ||
"type": "TSStringKeyword", | ||
"start":49,"end":55,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":31}} | ||
} | ||
}, | ||
"value": null | ||
}, | ||
{ | ||
"type": "ClassProperty", | ||
"start":58,"end":88,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":32}}, | ||
"readonly": true, | ||
"accessibility": "private", | ||
"static": false, | ||
"key": { | ||
"type": "Identifier", | ||
"start":75,"end":79,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":23},"identifierName":"foo2"}, | ||
"name": "foo2" | ||
}, | ||
"computed": false, | ||
"typeAnnotation": { | ||
"type": "TSTypeAnnotation", | ||
"start":79,"end":87,"loc":{"start":{"line":3,"column":23},"end":{"line":3,"column":31}}, | ||
"typeAnnotation": { | ||
"type": "TSStringKeyword", | ||
"start":81,"end":87,"loc":{"start":{"line":3,"column":25},"end":{"line":3,"column":31}} | ||
} | ||
}, | ||
"value": null | ||
}, | ||
{ | ||
"type": "ClassProperty", | ||
"start":91,"end":130,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":41}}, | ||
"readonly": true, | ||
"accessibility": "private", | ||
"override": true, | ||
"static": false, | ||
"key": { | ||
"type": "Identifier", | ||
"start":117,"end":121,"loc":{"start":{"line":4,"column":28},"end":{"line":4,"column":32},"identifierName":"foo3"}, | ||
"name": "foo3" | ||
}, | ||
"computed": false, | ||
"typeAnnotation": { | ||
"type": "TSTypeAnnotation", | ||
"start":121,"end":129,"loc":{"start":{"line":4,"column":32},"end":{"line":4,"column":40}}, | ||
"typeAnnotation": { | ||
"type": "TSStringKeyword", | ||
"start":123,"end":129,"loc":{"start":{"line":4,"column":34},"end":{"line":4,"column":40}} | ||
} | ||
}, | ||
"value": null | ||
}, | ||
{ | ||
"type": "ClassProperty", | ||
"start":133,"end":172,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":41}}, | ||
"accessibility": "private", | ||
"readonly": true, | ||
"override": true, | ||
"static": false, | ||
"key": { | ||
"type": "Identifier", | ||
"start":159,"end":163,"loc":{"start":{"line":5,"column":28},"end":{"line":5,"column":32},"identifierName":"foo4"}, | ||
"name": "foo4" | ||
}, | ||
"computed": false, | ||
"typeAnnotation": { | ||
"type": "TSTypeAnnotation", | ||
"start":163,"end":171,"loc":{"start":{"line":5,"column":32},"end":{"line":5,"column":40}}, | ||
"typeAnnotation": { | ||
"type": "TSStringKeyword", | ||
"start":165,"end":171,"loc":{"start":{"line":5,"column":34},"end":{"line":5,"column":40}} | ||
} | ||
}, | ||
"value": null | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |