swc/crates/swc_ecma_parser/tests/tsc/optionalChainingInArrow.json
Donny/강동윤 aa83584634
refactor(es/ast): Reimplement optional chaining (#7441)
**Related issue:**

 - Closes #7003.
 - Closes #7156.
2023-06-12 06:47:40 +00:00

188 lines
5.3 KiB
JSON

{
"type": "Script",
"span": {
"start": 101,
"end": 188,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 101,
"end": 188,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 107,
"end": 187,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 107,
"end": 111,
"ctxt": 0
},
"value": "test",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 114,
"end": 187,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 115,
"end": 130,
"ctxt": 0
},
"value": "names",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 120,
"end": 130,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 122,
"end": 130,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 122,
"end": 128,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"body": {
"type": "OptionalChainingExpression",
"span": {
"start": 166,
"end": 187,
"ctxt": 0
},
"optional": false,
"base": {
"type": "CallExpression",
"span": {
"start": 166,
"end": 187,
"ctxt": 0
},
"callee": {
"type": "OptionalChainingExpression",
"span": {
"start": 166,
"end": 179,
"ctxt": 0
},
"optional": true,
"base": {
"type": "MemberExpression",
"span": {
"start": 166,
"end": 179,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 166,
"end": 171,
"ctxt": 0
},
"value": "names",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 173,
"end": 179,
"ctxt": 0
},
"value": "filter",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 180,
"end": 186,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 180,
"end": 181,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "x",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
}
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
}
],
"interpreter": null
}