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

287 lines
7.7 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 110,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 9,
"end": 12,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 13,
"end": 22,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 13,
"end": 22,
"ctxt": 0
},
"value": "q",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 14,
"end": 22,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 16,
"end": 22,
"ctxt": 0
},
"kind": "string"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 24,
"end": 33,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 24,
"end": 33,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 25,
"end": 33,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 27,
"end": 33,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 0,
"end": 109,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 35,
"end": 109,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 41,
"end": 107,
"ctxt": 0
},
"argument": {
"type": "ConditionalExpression",
"span": {
"start": 48,
"end": 106,
"ctxt": 0
},
"test": {
"type": "BooleanLiteral",
"span": {
"start": 48,
"end": 52,
"ctxt": 0
},
"value": true
},
"consequent": {
"type": "ParenthesisExpression",
"span": {
"start": 55,
"end": 73,
"ctxt": 0
},
"expression": {
"type": "ConditionalExpression",
"span": {
"start": 56,
"end": 72,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 56,
"end": 57,
"ctxt": 0
},
"value": "q",
"optional": false
},
"consequent": {
"type": "BooleanLiteral",
"span": {
"start": 60,
"end": 64,
"ctxt": 0
},
"value": true
},
"alternate": {
"type": "BooleanLiteral",
"span": {
"start": 67,
"end": 72,
"ctxt": 0
},
"value": false
}
}
},
"alternate": {
"type": "ParenthesisExpression",
"span": {
"start": 76,
"end": 106,
"ctxt": 0
},
"expression": {
"type": "SequenceExpression",
"span": {
"start": 77,
"end": 105,
"ctxt": 0
},
"expressions": [
{
"type": "AssignmentExpression",
"span": {
"start": 77,
"end": 89,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 77,
"end": 78,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "MemberExpression",
"span": {
"start": 81,
"end": 89,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 81,
"end": 82,
"ctxt": 0
},
"value": "q",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 83,
"end": 89,
"ctxt": 0
},
"value": "length",
"optional": false
}
}
},
{
"type": "FunctionExpression",
"identifier": null,
"params": [],
"decorators": [],
"span": {
"start": 91,
"end": 105,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 102,
"end": 105,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "EmptyStatement",
"span": {
"start": 109,
"end": 110,
"ctxt": 0
}
}
],
"interpreter": null
}