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

1211 lines
39 KiB
JSON

{
"type": "Script",
"span": {
"start": 29,
"end": 363,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 29,
"end": 76,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 43,
"end": 75,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 43,
"end": 45,
"ctxt": 0
},
"value": "o1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 45,
"end": 75,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsParenthesizedType",
"span": {
"start": 47,
"end": 75,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 48,
"end": 74,
"ctxt": 0
},
"params": [
{
"type": "RestElement",
"span": {
"start": 49,
"end": 63,
"ctxt": 0
},
"rest": {
"start": 49,
"end": 52,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 52,
"end": 56,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 56,
"end": 63,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 58,
"end": 63,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 58,
"end": 61,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 65,
"end": 74,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 68,
"end": 74,
"ctxt": 0
},
"kind": "number"
}
}
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 77,
"end": 129,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 91,
"end": 128,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 91,
"end": 93,
"ctxt": 0
},
"value": "o2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 93,
"end": 128,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 95,
"end": 128,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 97,
"end": 126,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 97,
"end": 98,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 98,
"end": 126,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 100,
"end": 126,
"ctxt": 0
},
"params": [
{
"type": "RestElement",
"span": {
"start": 101,
"end": 115,
"ctxt": 0
},
"rest": {
"start": 101,
"end": 104,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 104,
"end": 108,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 108,
"end": 115,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 110,
"end": 115,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 110,
"end": 113,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 117,
"end": 126,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 120,
"end": 126,
"ctxt": 0
},
"kind": "number"
}
}
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 130,
"end": 204,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 144,
"end": 203,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 144,
"end": 146,
"ctxt": 0
},
"value": "o3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 146,
"end": 203,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 148,
"end": 203,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 150,
"end": 201,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 150,
"end": 151,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 151,
"end": 201,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsParenthesizedType",
"span": {
"start": 153,
"end": 201,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 154,
"end": 200,
"ctxt": 0
},
"params": [
{
"type": "RestElement",
"span": {
"start": 155,
"end": 169,
"ctxt": 0
},
"rest": {
"start": 155,
"end": 158,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 158,
"end": 162,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 162,
"end": 169,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 164,
"end": 169,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 164,
"end": 167,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 171,
"end": 200,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 174,
"end": 200,
"ctxt": 0
},
"params": [
{
"type": "RestElement",
"span": {
"start": 175,
"end": 189,
"ctxt": 0
},
"rest": {
"start": 175,
"end": 178,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 178,
"end": 182,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 182,
"end": 189,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 184,
"end": 189,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 184,
"end": 187,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 191,
"end": 200,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 194,
"end": 200,
"ctxt": 0
},
"kind": "number"
}
}
}
}
}
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 205,
"end": 287,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 219,
"end": 286,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 219,
"end": 221,
"ctxt": 0
},
"value": "o4",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 221,
"end": 286,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 223,
"end": 286,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 225,
"end": 284,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 225,
"end": 226,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 226,
"end": 284,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsParenthesizedType",
"span": {
"start": 228,
"end": 284,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 229,
"end": 282,
"ctxt": 0
},
"params": [
{
"type": "RestElement",
"span": {
"start": 230,
"end": 244,
"ctxt": 0
},
"rest": {
"start": 230,
"end": 233,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 233,
"end": 237,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 237,
"end": 244,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 239,
"end": 244,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 239,
"end": 242,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 246,
"end": 282,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 249,
"end": 282,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 251,
"end": 280,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 251,
"end": 252,
"ctxt": 0
},
"value": "c",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 252,
"end": 280,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 254,
"end": 280,
"ctxt": 0
},
"params": [
{
"type": "RestElement",
"span": {
"start": 255,
"end": 269,
"ctxt": 0
},
"rest": {
"start": 255,
"end": 258,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 258,
"end": 262,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 262,
"end": 269,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 264,
"end": 269,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 264,
"end": 267,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 271,
"end": 280,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 274,
"end": 280,
"ctxt": 0
},
"kind": "number"
}
}
}
},
"typeParams": null
}
]
}
}
}
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 289,
"end": 303,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 289,
"end": 302,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 289,
"end": 293,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 290,
"end": 292,
"ctxt": 0
},
"value": "o1",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "BinaryExpression",
"span": {
"start": 294,
"end": 301,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 294,
"end": 296,
"ctxt": 0
},
"value": "o1",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 300,
"end": 301,
"ctxt": 0
},
"value": 1.0
}
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 304,
"end": 321,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 304,
"end": 320,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 304,
"end": 311,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 305,
"end": 310,
"ctxt": 0
},
"questionDotToken": {
"start": 307,
"end": 308,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 305,
"end": 310,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 305,
"end": 307,
"ctxt": 0
},
"value": "o2",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 309,
"end": 310,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "BinaryExpression",
"span": {
"start": 312,
"end": 319,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 312,
"end": 314,
"ctxt": 0
},
"value": "o1",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 318,
"end": 319,
"ctxt": 0
},
"value": 1.0
}
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 322,
"end": 341,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 322,
"end": 340,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 322,
"end": 331,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 323,
"end": 330,
"ctxt": 0
},
"callee": {
"type": "OptionalChainingExpression",
"span": {
"start": 323,
"end": 328,
"ctxt": 0
},
"questionDotToken": {
"start": 325,
"end": 326,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 323,
"end": 328,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 323,
"end": 325,
"ctxt": 0
},
"value": "o3",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 327,
"end": 328,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "BinaryExpression",
"span": {
"start": 332,
"end": 339,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 332,
"end": 334,
"ctxt": 0
},
"value": "o1",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 338,
"end": 339,
"ctxt": 0
},
"value": 1.0
}
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 342,
"end": 363,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 342,
"end": 362,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 342,
"end": 353,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 343,
"end": 352,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 343,
"end": 350,
"ctxt": 0
},
"callee": {
"type": "OptionalChainingExpression",
"span": {
"start": 343,
"end": 348,
"ctxt": 0
},
"questionDotToken": {
"start": 345,
"end": 346,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 343,
"end": 348,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 343,
"end": 345,
"ctxt": 0
},
"value": "o4",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 347,
"end": 348,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 351,
"end": 352,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "BinaryExpression",
"span": {
"start": 354,
"end": 361,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 354,
"end": 356,
"ctxt": 0
},
"value": "o1",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 360,
"end": 361,
"ctxt": 0
},
"value": 1.0
}
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}