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

711 lines
17 KiB
JSON

{
"type": "Script",
"span": {
"start": 76,
"end": 348,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 85,
"end": 86,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 87,
"end": 88,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 87,
"end": 88,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 76,
"end": 92,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 90,
"end": 92,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 93,
"end": 97,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 93,
"end": 96,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 93,
"end": 94,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 123,
"end": 124,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 117,
"end": 169,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 129,
"end": 143,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 136,
"end": 137,
"ctxt": 0
},
"value": "m",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 138,
"end": 139,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 138,
"end": 139,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 129,
"end": 143,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 141,
"end": 143,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassProperty",
"span": {
"start": 146,
"end": 157,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 146,
"end": 147,
"ctxt": 0
},
"value": "p",
"optional": false
},
"value": {
"type": "ArrowFunctionExpression",
"span": {
"start": 150,
"end": 157,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 150,
"end": 151,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 155,
"end": 157,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 160,
"end": 167,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 160,
"end": 161,
"ctxt": 0
},
"value": "m",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 162,
"end": 163,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 162,
"end": 163,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 160,
"end": 167,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 165,
"end": 167,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ExpressionStatement",
"span": {
"start": 171,
"end": 177,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 171,
"end": 176,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 171,
"end": 174,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 171,
"end": 172,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 173,
"end": 174,
"ctxt": 0
},
"value": "m",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 202,
"end": 214,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 202,
"end": 213,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 202,
"end": 211,
"ctxt": 0
},
"object": {
"type": "NewExpression",
"span": {
"start": 202,
"end": 209,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 206,
"end": 207,
"ctxt": 0
},
"value": "C",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 210,
"end": 211,
"ctxt": 0
},
"value": "m",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 236,
"end": 248,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 236,
"end": 247,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 236,
"end": 245,
"ctxt": 0
},
"object": {
"type": "NewExpression",
"span": {
"start": 236,
"end": 243,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 240,
"end": 241,
"ctxt": 0
},
"value": "C",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 244,
"end": 245,
"ctxt": 0
},
"value": "p",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 271,
"end": 311,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 277,
"end": 310,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 277,
"end": 280,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 283,
"end": 310,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 287,
"end": 288,
"ctxt": 0
},
"value": "m",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 289,
"end": 290,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 289,
"end": 290,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 287,
"end": 294,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 292,
"end": 294,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 298,
"end": 299,
"ctxt": 0
},
"value": "p",
"optional": false
},
"value": {
"type": "ArrowFunctionExpression",
"span": {
"start": 301,
"end": 308,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 301,
"end": 302,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 306,
"end": 308,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 313,
"end": 321,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 313,
"end": 320,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 313,
"end": 318,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 313,
"end": 316,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 317,
"end": 318,
"ctxt": 0
},
"value": "m",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 340,
"end": 348,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 340,
"end": 347,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 340,
"end": 345,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 340,
"end": 343,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 344,
"end": 345,
"ctxt": 0
},
"value": "p",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
],
"interpreter": null
}