swc/crates/swc_ecma_parser/tests/tsc/newTargetNarrowing.json
2022-02-04 17:08:38 +09:00

303 lines
7.4 KiB
JSON

{
"type": "Script",
"span": {
"start": 34,
"end": 163,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 43,
"end": 46,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 47,
"end": 54,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 47,
"end": 54,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 48,
"end": 54,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 50,
"end": 54,
"ctxt": 0
},
"literal": {
"type": "BooleanLiteral",
"span": {
"start": 50,
"end": 54,
"ctxt": 0
},
"value": true
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 34,
"end": 59,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 56,
"end": 59,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 70,
"end": 71,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 61,
"end": 145,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 74,
"end": 145,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 78,
"end": 143,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 82,
"end": 108,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "MemberExpression",
"span": {
"start": 82,
"end": 99,
"ctxt": 0
},
"object": {
"type": "MetaProperty",
"span": {
"start": 82,
"end": 92,
"ctxt": 0
},
"kind": "new.target"
},
"property": {
"type": "Identifier",
"span": {
"start": 93,
"end": 99,
"ctxt": 0
},
"value": "marked",
"optional": false
}
},
"right": {
"type": "BooleanLiteral",
"span": {
"start": 104,
"end": 108,
"ctxt": 0
},
"value": true
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 110,
"end": 143,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 116,
"end": 139,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 116,
"end": 138,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 116,
"end": 119,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 120,
"end": 137,
"ctxt": 0
},
"object": {
"type": "MetaProperty",
"span": {
"start": 120,
"end": 130,
"ctxt": 0
},
"kind": "new.target"
},
"property": {
"type": "Identifier",
"span": {
"start": 131,
"end": 137,
"ctxt": 0
},
"value": "marked",
"optional": false
}
}
}
],
"typeArguments": null
}
}
]
},
"alternate": null
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 147,
"end": 163,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 147,
"end": 162,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 147,
"end": 155,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 147,
"end": 148,
"ctxt": 0
},
"value": "f",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 149,
"end": 155,
"ctxt": 0
},
"value": "marked",
"optional": false
}
},
"right": {
"type": "BooleanLiteral",
"span": {
"start": 158,
"end": 162,
"ctxt": 0
},
"value": true
}
}
}
],
"interpreter": null
}