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

287 lines
7.7 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 111,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 10,
"end": 13,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 14,
"end": 23,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 14,
"end": 23,
"ctxt": 0
},
"value": "q",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 15,
"end": 23,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 17,
"end": 23,
"ctxt": 0
},
"kind": "string"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 25,
"end": 34,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 25,
"end": 34,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 26,
"end": 34,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 28,
"end": 34,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 1,
"end": 110,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 36,
"end": 110,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 42,
"end": 108,
"ctxt": 0
},
"argument": {
"type": "ConditionalExpression",
"span": {
"start": 49,
"end": 107,
"ctxt": 0
},
"test": {
"type": "BooleanLiteral",
"span": {
"start": 49,
"end": 53,
"ctxt": 0
},
"value": true
},
"consequent": {
"type": "ParenthesisExpression",
"span": {
"start": 56,
"end": 74,
"ctxt": 0
},
"expression": {
"type": "ConditionalExpression",
"span": {
"start": 57,
"end": 73,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 57,
"end": 58,
"ctxt": 0
},
"value": "q",
"optional": false
},
"consequent": {
"type": "BooleanLiteral",
"span": {
"start": 61,
"end": 65,
"ctxt": 0
},
"value": true
},
"alternate": {
"type": "BooleanLiteral",
"span": {
"start": 68,
"end": 73,
"ctxt": 0
},
"value": false
}
}
},
"alternate": {
"type": "ParenthesisExpression",
"span": {
"start": 77,
"end": 107,
"ctxt": 0
},
"expression": {
"type": "SequenceExpression",
"span": {
"start": 78,
"end": 106,
"ctxt": 0
},
"expressions": [
{
"type": "AssignmentExpression",
"span": {
"start": 78,
"end": 90,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 78,
"end": 79,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "MemberExpression",
"span": {
"start": 82,
"end": 90,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 82,
"end": 83,
"ctxt": 0
},
"value": "q",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 84,
"end": 90,
"ctxt": 0
},
"value": "length",
"optional": false
}
}
},
{
"type": "FunctionExpression",
"identifier": null,
"params": [],
"decorators": [],
"span": {
"start": 92,
"end": 106,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 103,
"end": 106,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "EmptyStatement",
"span": {
"start": 110,
"end": 111,
"ctxt": 0
}
}
],
"interpreter": null
}