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

469 lines
14 KiB
JSON

{
"type": "Script",
"span": {
"start": 24,
"end": 169,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 24,
"end": 60,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 30,
"end": 60,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 30,
"end": 31,
"ctxt": 0
},
"value": "K",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 34,
"end": 60,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 40,
"end": 41,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 43,
"end": 46,
"ctxt": 0
},
"value": "a",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 52,
"end": 53,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 55,
"end": 58,
"ctxt": 0
},
"value": "b",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 61,
"end": 144,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 67,
"end": 143,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 67,
"end": 95,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Computed",
"span": {
"start": 69,
"end": 74,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 70,
"end": 73,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 70,
"end": 71,
"ctxt": 0
},
"value": "K",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 72,
"end": 73,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
"value": {
"type": "Identifier",
"span": {
"start": 76,
"end": 80,
"ctxt": 0
},
"value": "aVal",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Computed",
"span": {
"start": 82,
"end": 87,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 83,
"end": 86,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 83,
"end": 84,
"ctxt": 0
},
"value": "K",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 85,
"end": 86,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
"value": {
"type": "Identifier",
"span": {
"start": 89,
"end": 93,
"ctxt": 0
},
"value": "bVal",
"optional": false,
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 98,
"end": 143,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 98,
"end": 141,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 99,
"end": 140,
"ctxt": 0
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 105,
"end": 140,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 108,
"end": 138,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 115,
"end": 137,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Computed",
"span": {
"start": 117,
"end": 122,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 118,
"end": 121,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 118,
"end": 119,
"ctxt": 0
},
"value": "K",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 120,
"end": 121,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 124,
"end": 125,
"ctxt": 0
},
"value": 1.0
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Computed",
"span": {
"start": 127,
"end": 132,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 128,
"end": 131,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 128,
"end": 129,
"ctxt": 0
},
"value": "K",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 134,
"end": 135,
"ctxt": 0
},
"value": 1.0
}
}
]
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 145,
"end": 169,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 145,
"end": 168,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 145,
"end": 156,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 145,
"end": 152,
"ctxt": 0
},
"value": "console",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 153,
"end": 156,
"ctxt": 0
},
"value": "log",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 157,
"end": 161,
"ctxt": 0
},
"value": "aVal",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 163,
"end": 167,
"ctxt": 0
},
"value": "bVal",
"optional": false
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}