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

841 lines
18 KiB
JSON

{
"type": "Script",
"span": {
"start": 18,
"end": 472,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 27,
"end": 29,
"ctxt": 0
},
"value": "f1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 30,
"end": 31,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 30,
"end": 31,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 18,
"end": 36,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 34,
"end": 36,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 38,
"end": 45,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 38,
"end": 44,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 38,
"end": 40,
"ctxt": 0
},
"value": "f1",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 41,
"end": 42,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
],
"typeArguments": null
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 56,
"end": 58,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 59,
"end": 66,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 59,
"end": 66,
"ctxt": 0
},
"rest": {
"start": 59,
"end": 62,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 62,
"end": 66,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 47,
"end": 71,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 69,
"end": 71,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 126,
"end": 129,
"ctxt": 0
},
"value": "f25",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 130,
"end": 137,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 130,
"end": 137,
"ctxt": 0
},
"rest": {
"start": 130,
"end": 133,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 133,
"end": 137,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 109,
"end": 146,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 139,
"end": 145,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 141,
"end": 145,
"ctxt": 0
},
"kind": "void"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 148,
"end": 159,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 148,
"end": 158,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 148,
"end": 150,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"arguments": [
{
"spread": {
"start": 151,
"end": 154,
"ctxt": 0
},
"expression": {
"type": "ArrayExpression",
"span": {
"start": 154,
"end": 156,
"ctxt": 0
},
"elements": []
}
}
],
"typeArguments": null
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 207,
"end": 209,
"ctxt": 0
},
"value": "f3",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 210,
"end": 211,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 210,
"end": 211,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 190,
"end": 223,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 214,
"end": 222,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 216,
"end": 222,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 241,
"end": 243,
"ctxt": 0
},
"value": "f3",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 244,
"end": 245,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 244,
"end": 245,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 247,
"end": 248,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 247,
"end": 248,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 224,
"end": 259,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 250,
"end": 258,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 252,
"end": 258,
"ctxt": 0
},
"kind": "string"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 261,
"end": 276,
"ctxt": 0
},
"expression": {
"type": "TsTypeAssertion",
"span": {
"start": 261,
"end": 275,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 269,
"end": 275,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 269,
"end": 271,
"ctxt": 0
},
"value": "f3",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 272,
"end": 273,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
],
"typeArguments": null
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 262,
"end": 268,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 277,
"end": 295,
"ctxt": 0
},
"expression": {
"type": "TsTypeAssertion",
"span": {
"start": 277,
"end": 294,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 285,
"end": 294,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 285,
"end": 287,
"ctxt": 0
},
"value": "f3",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 288,
"end": 289,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 291,
"end": 292,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
],
"typeArguments": null
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 278,
"end": 284,
"ctxt": 0
},
"kind": "string"
}
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 333,
"end": 334,
"ctxt": 0
},
"value": "X",
"optional": false
},
"declare": false,
"span": {
"start": 327,
"end": 421,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 341,
"end": 360,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 341,
"end": 352,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 353,
"end": 354,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 353,
"end": 354,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 357,
"end": 360,
"ctxt": 0
},
"stmts": []
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassMethod",
"span": {
"start": 402,
"end": 419,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 406,
"end": 407,
"ctxt": 0
},
"value": "x",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 408,
"end": 413,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 408,
"end": 413,
"ctxt": 0
},
"value": "value",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 402,
"end": 419,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 416,
"end": 419,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 422,
"end": 460,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 432,
"end": 433,
"ctxt": 0
},
"value": "Y",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 434,
"end": 460,
"ctxt": 0
},
"body": [
{
"type": "TsConstructSignatureDeclaration",
"span": {
"start": 440,
"end": 448,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 444,
"end": 445,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
],
"typeAnnotation": null,
"typeParams": null
},
{
"type": "TsCallSignatureDeclaration",
"span": {
"start": 453,
"end": 458,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 454,
"end": 455,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
],
"typeAnnotation": null,
"typeParams": null
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 462,
"end": 472,
"ctxt": 0
},
"expression": {
"type": "NewExpression",
"span": {
"start": 462,
"end": 471,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 466,
"end": 467,
"ctxt": 0
},
"value": "X",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 468,
"end": 469,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}