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:
1
packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar-flow/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar-flow/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var a: {| x: number |} = {| x: 2 |}
|
||||
6
packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar-flow/options.json
vendored
Normal file
6
packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar-flow/options.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"plugins": [
|
||||
["recordAndTuple", { "syntaxType": "bar" }],
|
||||
["flow"]
|
||||
]
|
||||
}
|
||||
247
packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar-flow/output.json
vendored
Normal file
247
packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar-flow/output.json
vendored
Normal file
@@ -0,0 +1,247 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 4,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 4,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
},
|
||||
"identifierName": "a"
|
||||
},
|
||||
"name": "a",
|
||||
"typeAnnotation": {
|
||||
"type": "TypeAnnotation",
|
||||
"start": 5,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "ObjectTypeAnnotation",
|
||||
"start": 7,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"callProperties": [],
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectTypeProperty",
|
||||
"start": 10,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 10,
|
||||
"end": 11,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"identifierName": "x"
|
||||
},
|
||||
"name": "x"
|
||||
},
|
||||
"static": false,
|
||||
"proto": false,
|
||||
"kind": "init",
|
||||
"method": false,
|
||||
"value": {
|
||||
"type": "NumberTypeAnnotation",
|
||||
"start": 13,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 19
|
||||
}
|
||||
}
|
||||
},
|
||||
"variance": null,
|
||||
"optional": false
|
||||
}
|
||||
],
|
||||
"indexers": [],
|
||||
"internalSlots": [],
|
||||
"exact": true,
|
||||
"inexact": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"init": {
|
||||
"type": "RecordExpression",
|
||||
"start": 25,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 25
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 28,
|
||||
"end": 32,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 28
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 32
|
||||
}
|
||||
},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 28,
|
||||
"end": 29,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 28
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 29
|
||||
},
|
||||
"identifierName": "x"
|
||||
},
|
||||
"name": "x"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 31,
|
||||
"end": 32,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 31
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 32
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 2,
|
||||
"raw": "2"
|
||||
},
|
||||
"value": 2
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
16
packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar/input.js
vendored
Normal file
16
packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar/input.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
{||};
|
||||
|
||||
{| a: 1, b: 2, c: 3 |};
|
||||
|
||||
{|
|
||||
a: 1,
|
||||
b: {|
|
||||
c: 3,
|
||||
|},
|
||||
|};
|
||||
|
||||
[||];
|
||||
|
||||
[|1, 2, 3|];
|
||||
|
||||
[|1, [|2, 3|], 4|];
|
||||
3
packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": [["recordAndTuple", { "syntaxType": "bar" }]]
|
||||
}
|
||||
715
packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar/output.json
vendored
Normal file
715
packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar/output.json
vendored
Normal file
@@ -0,0 +1,715 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 112,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 112,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 5,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "RecordExpression",
|
||||
"start": 0,
|
||||
"end": 4,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
}
|
||||
},
|
||||
"properties": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 7,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 23
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "RecordExpression",
|
||||
"start": 7,
|
||||
"end": 29,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 10,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 7
|
||||
}
|
||||
},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 10,
|
||||
"end": 11,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 4
|
||||
},
|
||||
"identifierName": "a"
|
||||
},
|
||||
"name": "a"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 13,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 7
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 16,
|
||||
"end": 20,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 13
|
||||
}
|
||||
},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 16,
|
||||
"end": 17,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 10
|
||||
},
|
||||
"identifierName": "b"
|
||||
},
|
||||
"name": "b"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 19,
|
||||
"end": 20,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 13
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 2,
|
||||
"raw": "2"
|
||||
},
|
||||
"value": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 22,
|
||||
"end": 26,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 15
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 22,
|
||||
"end": 23,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 15
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 16
|
||||
},
|
||||
"identifierName": "c"
|
||||
},
|
||||
"name": "c"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 25,
|
||||
"end": 26,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 18
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 3,
|
||||
"raw": "3"
|
||||
},
|
||||
"value": 3
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 32,
|
||||
"end": 70,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 10,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "RecordExpression",
|
||||
"start": 32,
|
||||
"end": 69,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 10,
|
||||
"column": 2
|
||||
}
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 37,
|
||||
"end": 41,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 6
|
||||
}
|
||||
},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 37,
|
||||
"end": 38,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 3
|
||||
},
|
||||
"identifierName": "a"
|
||||
},
|
||||
"name": "a"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 40,
|
||||
"end": 41,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 6
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 45,
|
||||
"end": 65,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 7,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 4
|
||||
}
|
||||
},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 45,
|
||||
"end": 46,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 7,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 7,
|
||||
"column": 3
|
||||
},
|
||||
"identifierName": "b"
|
||||
},
|
||||
"name": "b"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "RecordExpression",
|
||||
"start": 48,
|
||||
"end": 65,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 7,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 4
|
||||
}
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 55,
|
||||
"end": 59,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 55,
|
||||
"end": 56,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 5
|
||||
},
|
||||
"identifierName": "c"
|
||||
},
|
||||
"name": "c"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 58,
|
||||
"end": 59,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 3,
|
||||
"raw": "3"
|
||||
},
|
||||
"value": 3
|
||||
}
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"trailingComma": 59
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"trailingComma": 65
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 72,
|
||||
"end": 77,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 12,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 5
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "TupleExpression",
|
||||
"start": 72,
|
||||
"end": 76,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 12,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 4
|
||||
}
|
||||
},
|
||||
"elements": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 79,
|
||||
"end": 91,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 14,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"column": 12
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "TupleExpression",
|
||||
"start": 79,
|
||||
"end": 90,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 14,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 81,
|
||||
"end": 82,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 14,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 84,
|
||||
"end": 85,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 14,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"column": 6
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 2,
|
||||
"raw": "2"
|
||||
},
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 87,
|
||||
"end": 88,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 14,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 3,
|
||||
"raw": "3"
|
||||
},
|
||||
"value": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 93,
|
||||
"end": 112,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "TupleExpression",
|
||||
"start": 93,
|
||||
"end": 111,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 95,
|
||||
"end": 96,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"type": "TupleExpression",
|
||||
"start": 98,
|
||||
"end": 106,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 13
|
||||
}
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 100,
|
||||
"end": 101,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 2,
|
||||
"raw": "2"
|
||||
},
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 103,
|
||||
"end": 104,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 3,
|
||||
"raw": "3"
|
||||
},
|
||||
"value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 108,
|
||||
"end": 109,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 15
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 4,
|
||||
"raw": "4"
|
||||
},
|
||||
"value": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
16
packages/babel-parser/test/fixtures/experimental/record-and-tuple/hash/input.js
vendored
Normal file
16
packages/babel-parser/test/fixtures/experimental/record-and-tuple/hash/input.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
#{};
|
||||
|
||||
#{ a: 1, b: 2, c: 3 };
|
||||
|
||||
#{
|
||||
a: 1,
|
||||
b: #{
|
||||
c: 3,
|
||||
},
|
||||
};
|
||||
|
||||
#[];
|
||||
|
||||
#[1, 2, 3];
|
||||
|
||||
#[1, #[2, 3], 4];
|
||||
3
packages/babel-parser/test/fixtures/experimental/record-and-tuple/hash/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/experimental/record-and-tuple/hash/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": [["recordAndTuple", { "syntaxType": "hash" }]]
|
||||
}
|
||||
715
packages/babel-parser/test/fixtures/experimental/record-and-tuple/hash/output.json
vendored
Normal file
715
packages/babel-parser/test/fixtures/experimental/record-and-tuple/hash/output.json
vendored
Normal file
@@ -0,0 +1,715 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 104,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 17
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 104,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 17
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 4,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "RecordExpression",
|
||||
"start": 0,
|
||||
"end": 3,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"properties": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 6,
|
||||
"end": 28,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "RecordExpression",
|
||||
"start": 6,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 21
|
||||
}
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 9,
|
||||
"end": 13,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 7
|
||||
}
|
||||
},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 9,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 4
|
||||
},
|
||||
"identifierName": "a"
|
||||
},
|
||||
"name": "a"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 12,
|
||||
"end": 13,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 7
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 15,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 13
|
||||
}
|
||||
},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 15,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 10
|
||||
},
|
||||
"identifierName": "b"
|
||||
},
|
||||
"name": "b"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 18,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 13
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 2,
|
||||
"raw": "2"
|
||||
},
|
||||
"value": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 21,
|
||||
"end": 25,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 15
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 21,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 15
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 16
|
||||
},
|
||||
"identifierName": "c"
|
||||
},
|
||||
"name": "c"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 24,
|
||||
"end": 25,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 18
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 3,
|
||||
"raw": "3"
|
||||
},
|
||||
"value": 3
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 30,
|
||||
"end": 66,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 10,
|
||||
"column": 2
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "RecordExpression",
|
||||
"start": 30,
|
||||
"end": 65,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 10,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 35,
|
||||
"end": 39,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 6
|
||||
}
|
||||
},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 35,
|
||||
"end": 36,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 3
|
||||
},
|
||||
"identifierName": "a"
|
||||
},
|
||||
"name": "a"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 38,
|
||||
"end": 39,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 6
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 43,
|
||||
"end": 62,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 7,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 43,
|
||||
"end": 44,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 7,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 7,
|
||||
"column": 3
|
||||
},
|
||||
"identifierName": "b"
|
||||
},
|
||||
"name": "b"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "RecordExpression",
|
||||
"start": 46,
|
||||
"end": 62,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 7,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 53,
|
||||
"end": 57,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 53,
|
||||
"end": 54,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 5
|
||||
},
|
||||
"identifierName": "c"
|
||||
},
|
||||
"name": "c"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 56,
|
||||
"end": 57,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 3,
|
||||
"raw": "3"
|
||||
},
|
||||
"value": 3
|
||||
}
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"trailingComma": 57
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"trailingComma": 62
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 68,
|
||||
"end": 72,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 12,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 4
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "TupleExpression",
|
||||
"start": 68,
|
||||
"end": 71,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 12,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"elements": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 74,
|
||||
"end": 85,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 14,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "TupleExpression",
|
||||
"start": 74,
|
||||
"end": 84,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 14,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"column": 10
|
||||
}
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 76,
|
||||
"end": 77,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 14,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 79,
|
||||
"end": 80,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 14,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"column": 6
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 2,
|
||||
"raw": "2"
|
||||
},
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 82,
|
||||
"end": 83,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 14,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 3,
|
||||
"raw": "3"
|
||||
},
|
||||
"value": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 87,
|
||||
"end": 104,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 17
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "TupleExpression",
|
||||
"start": 87,
|
||||
"end": 103,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 89,
|
||||
"end": 90,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"type": "TupleExpression",
|
||||
"start": 92,
|
||||
"end": 99,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 12
|
||||
}
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 94,
|
||||
"end": 95,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 2,
|
||||
"raw": "2"
|
||||
},
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 97,
|
||||
"end": 98,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 3,
|
||||
"raw": "3"
|
||||
},
|
||||
"value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 101,
|
||||
"end": 102,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 4,
|
||||
"raw": "4"
|
||||
},
|
||||
"value": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["recordAndTuple", { "syntaxType": "hash" }]],
|
||||
"throws": "Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar' (1:0)"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{|
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["recordAndTuple", { "syntaxType": "hash" }]],
|
||||
"throws": "Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar' (1:0)"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
#{
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["recordAndTuple", { "syntaxType": "bar" }]],
|
||||
"throws": "Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash' (1:0)"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|]
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["recordAndTuple", { "syntaxType": "hash" }]],
|
||||
"throws": "Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar' (1:0)"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
[|
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["recordAndTuple", { "syntaxType": "hash" }]],
|
||||
"throws": "Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar' (1:0)"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
#[
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["recordAndTuple", { "syntaxType": "bar" }]],
|
||||
"throws": "Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash' (1:0)"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{||}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["recordAndTuple", { "syntaxType": "invalid" }]],
|
||||
"throws": "'recordAndTuple' requires 'syntaxType' option whose value should be one of: 'hash', 'bar'"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
[||]
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["recordAndTuple", { "syntaxType": "invalid" }]],
|
||||
"throws": "'recordAndTuple' requires 'syntaxType' option whose value should be one of: 'hash', 'bar'"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
#{}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["recordAndTuple", { "syntaxType": "invalid" }]],
|
||||
"throws": "'recordAndTuple' requires 'syntaxType' option whose value should be one of: 'hash', 'bar'"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
#[]
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["recordAndTuple", { "syntaxType": "invalid" }]],
|
||||
"throws": "'recordAndTuple' requires 'syntaxType' option whose value should be one of: 'hash', 'bar'"
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/experimental/record-and-tuple/not-enabled-bar/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/experimental/record-and-tuple/not-enabled-bar/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{||}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [],
|
||||
"throws": "Unexpected token (1:1)"
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/experimental/record-and-tuple/not-enabled-hash/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/experimental/record-and-tuple/not-enabled-hash/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#{};
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [],
|
||||
"throws": "Unexpected character '#' (1:0)"
|
||||
}
|
||||
Reference in New Issue
Block a user