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

486 lines
10 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 1,
"end": 192,
"ctxt": 0
},
"body": [
{
"type": "TsEnumDeclaration",
"span": {
"start": 1,
"end": 33,
"ctxt": 0
},
"declare": false,
"isConst": true,
"id": {
"type": "Identifier",
"span": {
"start": 12,
"end": 20,
"ctxt": 0
},
"value": "TestType",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 23,
"end": 26,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 23,
"end": 26,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"init": null
},
{
"type": "TsEnumMember",
"span": {
"start": 28,
"end": 31,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 28,
"end": 31,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"init": null
}
]
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 34,
"end": 75,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 39,
"end": 50,
"ctxt": 0
},
"value": "TestTypeStr",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeOperator",
"span": {
"start": 53,
"end": 74,
"ctxt": 0
},
"op": "keyof",
"typeAnnotation": {
"type": "TsTypeQuery",
"span": {
"start": 59,
"end": 74,
"ctxt": 0
},
"exprName": {
"type": "Identifier",
"span": {
"start": 66,
"end": 74,
"ctxt": 0
},
"value": "TestType",
"optional": false
},
"typeArguments": null
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 86,
"end": 88,
"ctxt": 0
},
"value": "f1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 89,
"end": 100,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 89,
"end": 100,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 90,
"end": 100,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 92,
"end": 100,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 92,
"end": 100,
"ctxt": 0
},
"value": "TestType",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 77,
"end": 105,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 102,
"end": 105,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 115,
"end": 117,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 118,
"end": 132,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 118,
"end": 132,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 119,
"end": 132,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 121,
"end": 132,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 121,
"end": 132,
"ctxt": 0
},
"value": "TestTypeStr",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 106,
"end": 137,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 134,
"end": 137,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 139,
"end": 155,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 139,
"end": 155,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 139,
"end": 141,
"ctxt": 0
},
"value": "f1",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 142,
"end": 154,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 142,
"end": 150,
"ctxt": 0
},
"value": "TestType",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 151,
"end": 154,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 156,
"end": 172,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 156,
"end": 172,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 156,
"end": 158,
"ctxt": 0
},
"value": "f1",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 159,
"end": 171,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 159,
"end": 167,
"ctxt": 0
},
"value": "TestType",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 168,
"end": 171,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 173,
"end": 182,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 173,
"end": 182,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 173,
"end": 175,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 176,
"end": 181,
"ctxt": 0
},
"value": "foo",
"raw": "'foo'"
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 183,
"end": 192,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 183,
"end": 192,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 183,
"end": 185,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 186,
"end": 191,
"ctxt": 0
},
"value": "bar",
"raw": "'bar'"
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}