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

387 lines
10 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 25,
"end": 156,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 25,
"end": 39,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 31,
"end": 38,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 31,
"end": 32,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "StringLiteral",
"span": {
"start": 35,
"end": 38,
"ctxt": 0
},
"value": "a",
"raw": "\"a\""
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 40,
"end": 54,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 46,
"end": 53,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 46,
"end": 47,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "StringLiteral",
"span": {
"start": 50,
"end": 53,
"ctxt": 0
},
"value": "b",
"raw": "\"b\""
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 56,
"end": 131,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 62,
"end": 130,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 62,
"end": 86,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Computed",
"span": {
"start": 64,
"end": 67,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 65,
"end": 66,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"value": {
"type": "Identifier",
"span": {
"start": 69,
"end": 73,
"ctxt": 0
},
"value": "aVal",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Computed",
"span": {
"start": 75,
"end": 78,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 76,
"end": 77,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"value": {
"type": "Identifier",
"span": {
"start": 80,
"end": 84,
"ctxt": 0
},
"value": "bVal",
"optional": false,
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 89,
"end": 130,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 89,
"end": 128,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 90,
"end": 127,
"ctxt": 0
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 96,
"end": 127,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 99,
"end": 125,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 106,
"end": 124,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Computed",
"span": {
"start": 108,
"end": 111,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 109,
"end": 110,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 113,
"end": 114,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Computed",
"span": {
"start": 116,
"end": 119,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 117,
"end": 118,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 121,
"end": 122,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 132,
"end": 156,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 132,
"end": 155,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 132,
"end": 143,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 132,
"end": 139,
"ctxt": 0
},
"value": "console",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 140,
"end": 143,
"ctxt": 0
},
"value": "log",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 144,
"end": 148,
"ctxt": 0
},
"value": "aVal",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 150,
"end": 154,
"ctxt": 0
},
"value": "bVal",
"optional": false
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}