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

494 lines
11 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 191,
"ctxt": 0
},
"body": [
{
"type": "TsEnumDeclaration",
"span": {
"start": 0,
"end": 32,
"ctxt": 0
},
"declare": false,
"isConst": true,
"id": {
"type": "Identifier",
"span": {
"start": 11,
"end": 19,
"ctxt": 0
},
"value": "TestType",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 22,
"end": 25,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 22,
"end": 25,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"init": null
},
{
"type": "TsEnumMember",
"span": {
"start": 27,
"end": 30,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 27,
"end": 30,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"init": null
}
]
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 33,
"end": 74,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 38,
"end": 49,
"ctxt": 0
},
"value": "TestTypeStr",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeOperator",
"span": {
"start": 52,
"end": 73,
"ctxt": 0
},
"op": "keyof",
"typeAnnotation": {
"type": "TsTypeQuery",
"span": {
"start": 58,
"end": 73,
"ctxt": 0
},
"exprName": {
"type": "Identifier",
"span": {
"start": 65,
"end": 73,
"ctxt": 0
},
"value": "TestType",
"optional": false
},
"typeArguments": null
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 85,
"end": 87,
"ctxt": 0
},
"value": "f1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 88,
"end": 99,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 88,
"end": 99,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 89,
"end": 99,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 91,
"end": 99,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 91,
"end": 99,
"ctxt": 0
},
"value": "TestType",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 76,
"end": 104,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 101,
"end": 104,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 114,
"end": 116,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 117,
"end": 131,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 117,
"end": 131,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 118,
"end": 131,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 120,
"end": 131,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 120,
"end": 131,
"ctxt": 0
},
"value": "TestTypeStr",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 105,
"end": 136,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 133,
"end": 136,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 138,
"end": 154,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 138,
"end": 154,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 138,
"end": 140,
"ctxt": 0
},
"value": "f1",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 141,
"end": 153,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 141,
"end": 149,
"ctxt": 0
},
"value": "TestType",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 150,
"end": 153,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 155,
"end": 171,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 155,
"end": 171,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 155,
"end": 157,
"ctxt": 0
},
"value": "f1",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 158,
"end": 170,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 158,
"end": 166,
"ctxt": 0
},
"value": "TestType",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 167,
"end": 170,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 172,
"end": 181,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 172,
"end": 181,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 172,
"end": 174,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 175,
"end": 180,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 182,
"end": 191,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 182,
"end": 191,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 182,
"end": 184,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 185,
"end": 190,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}