swc/crates/swc_ecma_parser/tests/tsc/restElementWithAssignmentPattern4.json

352 lines
9.0 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 95,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 0,
"end": 25,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 4,
"end": 13,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 4,
"end": 5,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 5,
"end": 13,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 7,
"end": 13,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": null,
"definite": false
},
{
"type": "VariableDeclarator",
"span": {
"start": 15,
"end": 24,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 15,
"end": 16,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 16,
"end": 24,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 18,
"end": 24,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 26,
"end": 64,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 30,
"end": 63,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 30,
"end": 35,
"ctxt": 0
},
"value": "tuple",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 35,
"end": 53,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTupleType",
"span": {
"start": 37,
"end": 53,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 38,
"end": 44,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 38,
"end": 44,
"ctxt": 0
},
"kind": "string"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 46,
"end": 52,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 46,
"end": 52,
"ctxt": 0
},
"kind": "number"
}
}
]
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 56,
"end": 63,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 57,
"end": 59,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 61,
"end": 62,
"ctxt": 0
},
"value": 1.0
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 65,
"end": 95,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 65,
"end": 94,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ArrayPattern",
"span": {
"start": 65,
"end": 86,
"ctxt": 0
},
"elements": [
{
"type": "RestElement",
"span": {
"start": 69,
"end": 85,
"ctxt": 0
},
"rest": {
"start": 66,
"end": 69,
"ctxt": 0
},
"argument": {
"type": "ObjectPattern",
"span": {
"start": 69,
"end": 85,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "NumericLiteral",
"span": {
"start": 71,
"end": 72,
"ctxt": 0
},
"value": 0.0
},
"value": {
"type": "AssignmentPattern",
"span": {
"start": 74,
"end": 80,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 74,
"end": 75,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 78,
"end": 80,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"typeAnnotation": null
}
},
{
"type": "AssignmentPatternProperty",
"span": {
"start": 82,
"end": 83,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 82,
"end": 83,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": null
}
],
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 89,
"end": 94,
"ctxt": 0
},
"value": "tuple",
"optional": false
}
}
}
],
"interpreter": null
}