Added support for record and tuple syntax. (#10865)
* Added support for record and tuple syntax.
This commit adds support for both the hash #{} and bar {||}
syntaxes to babel-parser, as well as adds the supporting
babel-plugin-syntax-record-and-tuple plugin to enable support
for the syntax. Does not include any transform for records and
tuples.
* typo
* added check to ensure recordAndTuple in babel-parser
* switched to syntaxType option instead of explicit entries for each record and tuple type
* switched to using recordAndTupleSyntaxType for generator options instead of adding to node
* added tests for generator option recordAndTupleSyntaxType
* added test for record and tuple bar syntax with flow typings
* added tests for invalid/missing recordAndTuple syntaxType parser option
* fixed flowcheck errors
* fix merge with class privates in tokenizer
* Update packages/babel-parser/src/types.js
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
* improved recordAndTuple generator error message, added tests for invalid,missing options
* updated error messages for invalid parser syntaxType option
* updated error message
* added better error messages for when the recordAndTuple syntaxType is doesn't match the syntax used
* updated record and tuple support to use new error message templates
* added recordAndTuple to missing plugin helpers
* Fix linting
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
@@ -58,6 +58,8 @@ These are the core @babel/parser (babylon) AST node types.
|
||||
- [ObjectMember](#objectmember)
|
||||
- [ObjectProperty](#objectproperty)
|
||||
- [ObjectMethod](#objectmethod)
|
||||
- [RecordExpression](#recordexpression)
|
||||
- [TupleExpression](#tupleexpression)
|
||||
- [FunctionExpression](#functionexpression)
|
||||
- [Unary operations](#unary-operations)
|
||||
- [UnaryExpression](#unaryexpression)
|
||||
@@ -719,6 +721,24 @@ interface ObjectMethod <: ObjectMember, Function {
|
||||
}
|
||||
```
|
||||
|
||||
## RecordExpression
|
||||
|
||||
```js
|
||||
interface RecordExpression <: Expression {
|
||||
type: "RecordExpression";
|
||||
properties: [ ObjectProperty | ObjectMethod | SpreadElement ];
|
||||
}
|
||||
```
|
||||
|
||||
## TupleExpression
|
||||
|
||||
```js
|
||||
interface TupleExpression <: Expression {
|
||||
type: "TupleExpression";
|
||||
elements: [ Expression | SpreadElement | null ];
|
||||
}
|
||||
```
|
||||
|
||||
## FunctionExpression
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user