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

325 lines
8.0 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 0,
"end": 89,
"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": "",
"raw": "\"\""
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 61,
"end": 62,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 65,
"end": 89,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 65,
"end": 88,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ArrayPattern",
"span": {
"start": 65,
"end": 80,
"ctxt": 0
},
"elements": [
{
"type": "RestElement",
"span": {
"start": 69,
"end": 79,
"ctxt": 0
},
"rest": {
"start": 66,
"end": 69,
"ctxt": 0
},
"argument": {
"type": "ArrayPattern",
"span": {
"start": 69,
"end": 79,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 70,
"end": 71,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
{
"type": "AssignmentPattern",
"span": {
"start": 73,
"end": 78,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 73,
"end": 74,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 77,
"end": 78,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 83,
"end": 88,
"ctxt": 0
},
"value": "tuple",
"optional": false
}
}
}
],
"interpreter": null
}