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

463 lines
14 KiB
JSON

{
"type": "Script",
"span": {
"start": 25,
"end": 170,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 25,
"end": 61,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 31,
"end": 61,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 31,
"end": 32,
"ctxt": 0
},
"value": "K",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 35,
"end": 61,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 41,
"end": 42,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 44,
"end": 47,
"ctxt": 0
},
"value": "a",
"raw": "\"a\""
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 53,
"end": 54,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 56,
"end": 59,
"ctxt": 0
},
"value": "b",
"raw": "\"b\""
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 62,
"end": 145,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 68,
"end": 144,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 68,
"end": 96,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Computed",
"span": {
"start": 70,
"end": 75,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 71,
"end": 74,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 71,
"end": 72,
"ctxt": 0
},
"value": "K",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 73,
"end": 74,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
"value": {
"type": "Identifier",
"span": {
"start": 77,
"end": 81,
"ctxt": 0
},
"value": "aVal",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Computed",
"span": {
"start": 83,
"end": 88,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 84,
"end": 87,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 84,
"end": 85,
"ctxt": 0
},
"value": "K",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 86,
"end": 87,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
"value": {
"type": "Identifier",
"span": {
"start": 90,
"end": 94,
"ctxt": 0
},
"value": "bVal",
"optional": false,
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 99,
"end": 144,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 99,
"end": 142,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 100,
"end": 141,
"ctxt": 0
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 106,
"end": 141,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 109,
"end": 139,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 116,
"end": 138,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Computed",
"span": {
"start": 118,
"end": 123,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 119,
"end": 122,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 119,
"end": 120,
"ctxt": 0
},
"value": "K",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 121,
"end": 122,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 125,
"end": 126,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Computed",
"span": {
"start": 128,
"end": 133,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 129,
"end": 132,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 129,
"end": 130,
"ctxt": 0
},
"value": "K",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 135,
"end": 136,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 146,
"end": 170,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 146,
"end": 169,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 146,
"end": 157,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 146,
"end": 153,
"ctxt": 0
},
"value": "console",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 154,
"end": 157,
"ctxt": 0
},
"value": "log",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 158,
"end": 162,
"ctxt": 0
},
"value": "aVal",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 164,
"end": 168,
"ctxt": 0
},
"value": "bVal",
"optional": false
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}