mirror of
https://github.com/swc-project/swc.git
synced 2024-11-24 10:12:42 +03:00
019cf37199
**Related issue:** - https://github.com/microsoft/TypeScript/pull/51865.
713 lines
20 KiB
JSON
713 lines
20 KiB
JSON
{
|
|
"type": "Script",
|
|
"span": {
|
|
"start": 1,
|
|
"end": 248,
|
|
"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": 17,
|
|
"end": 38,
|
|
"ctxt": 0
|
|
},
|
|
"decorators": [],
|
|
"pat": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 17,
|
|
"end": 38,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 18,
|
|
"end": 38,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsTypeLiteral",
|
|
"span": {
|
|
"start": 20,
|
|
"end": 38,
|
|
"ctxt": 0
|
|
},
|
|
"members": [
|
|
{
|
|
"type": "TsPropertySignature",
|
|
"span": {
|
|
"start": 22,
|
|
"end": 29,
|
|
"ctxt": 0
|
|
},
|
|
"readonly": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 22,
|
|
"end": 25,
|
|
"ctxt": 0
|
|
},
|
|
"value": "bar",
|
|
"optional": false
|
|
},
|
|
"computed": false,
|
|
"optional": false,
|
|
"init": null,
|
|
"params": [],
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 25,
|
|
"end": 28,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsTypeReference",
|
|
"span": {
|
|
"start": 27,
|
|
"end": 28,
|
|
"ctxt": 0
|
|
},
|
|
"typeName": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 27,
|
|
"end": 28,
|
|
"ctxt": 0
|
|
},
|
|
"value": "T",
|
|
"optional": false
|
|
},
|
|
"typeParams": null
|
|
}
|
|
},
|
|
"typeParams": null
|
|
},
|
|
{
|
|
"type": "TsPropertySignature",
|
|
"span": {
|
|
"start": 30,
|
|
"end": 36,
|
|
"ctxt": 0
|
|
},
|
|
"readonly": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 30,
|
|
"end": 33,
|
|
"ctxt": 0
|
|
},
|
|
"value": "baz",
|
|
"optional": false
|
|
},
|
|
"computed": false,
|
|
"optional": false,
|
|
"init": null,
|
|
"params": [],
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 33,
|
|
"end": 36,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsTypeReference",
|
|
"span": {
|
|
"start": 35,
|
|
"end": 36,
|
|
"ctxt": 0
|
|
},
|
|
"typeName": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 35,
|
|
"end": 36,
|
|
"ctxt": 0
|
|
},
|
|
"value": "T",
|
|
"optional": false
|
|
},
|
|
"typeParams": null
|
|
}
|
|
},
|
|
"typeParams": null
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"decorators": [],
|
|
"span": {
|
|
"start": 1,
|
|
"end": 57,
|
|
"ctxt": 0
|
|
},
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 40,
|
|
"end": 57,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ReturnStatement",
|
|
"span": {
|
|
"start": 46,
|
|
"end": 55,
|
|
"ctxt": 0
|
|
},
|
|
"argument": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 53,
|
|
"end": 54,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"generator": false,
|
|
"async": false,
|
|
"typeParameters": {
|
|
"type": "TsTypeParameterDeclaration",
|
|
"span": {
|
|
"start": 13,
|
|
"end": 16,
|
|
"ctxt": 0
|
|
},
|
|
"parameters": [
|
|
{
|
|
"type": "TsTypeParameter",
|
|
"span": {
|
|
"start": 14,
|
|
"end": 15,
|
|
"ctxt": 0
|
|
},
|
|
"name": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 14,
|
|
"end": 15,
|
|
"ctxt": 0
|
|
},
|
|
"value": "T",
|
|
"optional": false
|
|
},
|
|
"in": false,
|
|
"out": false,
|
|
"const": false,
|
|
"constraint": null,
|
|
"default": null
|
|
}
|
|
]
|
|
},
|
|
"returnType": null
|
|
},
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"span": {
|
|
"start": 59,
|
|
"end": 92,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "var",
|
|
"declare": false,
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"span": {
|
|
"start": 63,
|
|
"end": 91,
|
|
"ctxt": 0
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 63,
|
|
"end": 64,
|
|
"ctxt": 0
|
|
},
|
|
"value": "r",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
},
|
|
"init": {
|
|
"type": "CallExpression",
|
|
"span": {
|
|
"start": 67,
|
|
"end": 91,
|
|
"ctxt": 0
|
|
},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 67,
|
|
"end": 70,
|
|
"ctxt": 0
|
|
},
|
|
"value": "foo",
|
|
"optional": false
|
|
},
|
|
"arguments": [
|
|
{
|
|
"spread": null,
|
|
"expression": {
|
|
"type": "ObjectExpression",
|
|
"span": {
|
|
"start": 71,
|
|
"end": 90,
|
|
"ctxt": 0
|
|
},
|
|
"properties": [
|
|
{
|
|
"type": "KeyValueProperty",
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 73,
|
|
"end": 76,
|
|
"ctxt": 0
|
|
},
|
|
"value": "bar",
|
|
"optional": false
|
|
},
|
|
"value": {
|
|
"type": "NumericLiteral",
|
|
"span": {
|
|
"start": 78,
|
|
"end": 79,
|
|
"ctxt": 0
|
|
},
|
|
"value": 1.0,
|
|
"raw": "1"
|
|
}
|
|
},
|
|
{
|
|
"type": "KeyValueProperty",
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 81,
|
|
"end": 84,
|
|
"ctxt": 0
|
|
},
|
|
"value": "baz",
|
|
"optional": false
|
|
},
|
|
"value": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 86,
|
|
"end": 88,
|
|
"ctxt": 0
|
|
},
|
|
"value": "",
|
|
"raw": "''"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"typeArguments": null
|
|
},
|
|
"definite": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"span": {
|
|
"start": 102,
|
|
"end": 135,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "var",
|
|
"declare": false,
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"span": {
|
|
"start": 106,
|
|
"end": 134,
|
|
"ctxt": 0
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 106,
|
|
"end": 108,
|
|
"ctxt": 0
|
|
},
|
|
"value": "r2",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
},
|
|
"init": {
|
|
"type": "CallExpression",
|
|
"span": {
|
|
"start": 111,
|
|
"end": 134,
|
|
"ctxt": 0
|
|
},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 111,
|
|
"end": 114,
|
|
"ctxt": 0
|
|
},
|
|
"value": "foo",
|
|
"optional": false
|
|
},
|
|
"arguments": [
|
|
{
|
|
"spread": null,
|
|
"expression": {
|
|
"type": "ObjectExpression",
|
|
"span": {
|
|
"start": 115,
|
|
"end": 133,
|
|
"ctxt": 0
|
|
},
|
|
"properties": [
|
|
{
|
|
"type": "KeyValueProperty",
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 117,
|
|
"end": 120,
|
|
"ctxt": 0
|
|
},
|
|
"value": "bar",
|
|
"optional": false
|
|
},
|
|
"value": {
|
|
"type": "NumericLiteral",
|
|
"span": {
|
|
"start": 122,
|
|
"end": 123,
|
|
"ctxt": 0
|
|
},
|
|
"value": 1.0,
|
|
"raw": "1"
|
|
}
|
|
},
|
|
{
|
|
"type": "KeyValueProperty",
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 125,
|
|
"end": 128,
|
|
"ctxt": 0
|
|
},
|
|
"value": "baz",
|
|
"optional": false
|
|
},
|
|
"value": {
|
|
"type": "NumericLiteral",
|
|
"span": {
|
|
"start": 130,
|
|
"end": 131,
|
|
"ctxt": 0
|
|
},
|
|
"value": 1.0,
|
|
"raw": "1"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"typeArguments": null
|
|
},
|
|
"definite": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"span": {
|
|
"start": 150,
|
|
"end": 187,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "var",
|
|
"declare": false,
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"span": {
|
|
"start": 154,
|
|
"end": 186,
|
|
"ctxt": 0
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 154,
|
|
"end": 156,
|
|
"ctxt": 0
|
|
},
|
|
"value": "r3",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
},
|
|
"init": {
|
|
"type": "CallExpression",
|
|
"span": {
|
|
"start": 159,
|
|
"end": 186,
|
|
"ctxt": 0
|
|
},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 159,
|
|
"end": 162,
|
|
"ctxt": 0
|
|
},
|
|
"value": "foo",
|
|
"optional": false
|
|
},
|
|
"arguments": [
|
|
{
|
|
"spread": null,
|
|
"expression": {
|
|
"type": "ObjectExpression",
|
|
"span": {
|
|
"start": 163,
|
|
"end": 185,
|
|
"ctxt": 0
|
|
},
|
|
"properties": [
|
|
{
|
|
"type": "KeyValueProperty",
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 165,
|
|
"end": 168,
|
|
"ctxt": 0
|
|
},
|
|
"value": "bar",
|
|
"optional": false
|
|
},
|
|
"value": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 170,
|
|
"end": 173,
|
|
"ctxt": 0
|
|
},
|
|
"value": "foo",
|
|
"optional": false
|
|
}
|
|
},
|
|
{
|
|
"type": "KeyValueProperty",
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 175,
|
|
"end": 178,
|
|
"ctxt": 0
|
|
},
|
|
"value": "baz",
|
|
"optional": false
|
|
},
|
|
"value": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 180,
|
|
"end": 183,
|
|
"ctxt": 0
|
|
},
|
|
"value": "foo",
|
|
"optional": false
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"typeArguments": null
|
|
},
|
|
"definite": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"span": {
|
|
"start": 206,
|
|
"end": 248,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "var",
|
|
"declare": false,
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"span": {
|
|
"start": 210,
|
|
"end": 247,
|
|
"ctxt": 0
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 210,
|
|
"end": 212,
|
|
"ctxt": 0
|
|
},
|
|
"value": "r4",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
},
|
|
"init": {
|
|
"type": "CallExpression",
|
|
"span": {
|
|
"start": 215,
|
|
"end": 247,
|
|
"ctxt": 0
|
|
},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 215,
|
|
"end": 218,
|
|
"ctxt": 0
|
|
},
|
|
"value": "foo",
|
|
"optional": false
|
|
},
|
|
"arguments": [
|
|
{
|
|
"spread": null,
|
|
"expression": {
|
|
"type": "ObjectExpression",
|
|
"span": {
|
|
"start": 227,
|
|
"end": 246,
|
|
"ctxt": 0
|
|
},
|
|
"properties": [
|
|
{
|
|
"type": "KeyValueProperty",
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 229,
|
|
"end": 232,
|
|
"ctxt": 0
|
|
},
|
|
"value": "bar",
|
|
"optional": false
|
|
},
|
|
"value": {
|
|
"type": "NumericLiteral",
|
|
"span": {
|
|
"start": 234,
|
|
"end": 235,
|
|
"ctxt": 0
|
|
},
|
|
"value": 1.0,
|
|
"raw": "1"
|
|
}
|
|
},
|
|
{
|
|
"type": "KeyValueProperty",
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 237,
|
|
"end": 240,
|
|
"ctxt": 0
|
|
},
|
|
"value": "baz",
|
|
"optional": false
|
|
},
|
|
"value": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 242,
|
|
"end": 244,
|
|
"ctxt": 0
|
|
},
|
|
"value": "",
|
|
"raw": "''"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"typeArguments": {
|
|
"type": "TsTypeParameterInstantiation",
|
|
"span": {
|
|
"start": 218,
|
|
"end": 226,
|
|
"ctxt": 0
|
|
},
|
|
"params": [
|
|
{
|
|
"type": "TsTypeReference",
|
|
"span": {
|
|
"start": 219,
|
|
"end": 225,
|
|
"ctxt": 0
|
|
},
|
|
"typeName": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 219,
|
|
"end": 225,
|
|
"ctxt": 0
|
|
},
|
|
"value": "Object",
|
|
"optional": false
|
|
},
|
|
"typeParams": null
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"definite": false
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"interpreter": null
|
|
}
|