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

711 lines
17 KiB
JSON

{
"type": "Script",
"span": {
"start": 77,
"end": 349,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 86,
"end": 87,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 88,
"end": 89,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 88,
"end": 89,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 77,
"end": 93,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 91,
"end": 93,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 94,
"end": 98,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 94,
"end": 97,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 94,
"end": 95,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 124,
"end": 125,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 118,
"end": 170,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 130,
"end": 144,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 137,
"end": 138,
"ctxt": 0
},
"value": "m",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 139,
"end": 140,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 139,
"end": 140,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 130,
"end": 144,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 142,
"end": 144,
"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": 147,
"end": 158,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 147,
"end": 148,
"ctxt": 0
},
"value": "p",
"optional": false
},
"value": {
"type": "ArrowFunctionExpression",
"span": {
"start": 151,
"end": 158,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 151,
"end": 152,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 156,
"end": 158,
"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": 161,
"end": 168,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 161,
"end": 162,
"ctxt": 0
},
"value": "m",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 163,
"end": 164,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 163,
"end": 164,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 161,
"end": 168,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 166,
"end": 168,
"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": 172,
"end": 178,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 172,
"end": 177,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 172,
"end": 175,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 172,
"end": 173,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 174,
"end": 175,
"ctxt": 0
},
"value": "m",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 203,
"end": 215,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 203,
"end": 214,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 203,
"end": 212,
"ctxt": 0
},
"object": {
"type": "NewExpression",
"span": {
"start": 203,
"end": 210,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 207,
"end": 208,
"ctxt": 0
},
"value": "C",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 211,
"end": 212,
"ctxt": 0
},
"value": "m",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 237,
"end": 249,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 237,
"end": 248,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 237,
"end": 246,
"ctxt": 0
},
"object": {
"type": "NewExpression",
"span": {
"start": 237,
"end": 244,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 241,
"end": 242,
"ctxt": 0
},
"value": "C",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 245,
"end": 246,
"ctxt": 0
},
"value": "p",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 272,
"end": 312,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 278,
"end": 311,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 278,
"end": 281,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 284,
"end": 311,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 288,
"end": 289,
"ctxt": 0
},
"value": "m",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 290,
"end": 291,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 290,
"end": 291,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 288,
"end": 295,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 293,
"end": 295,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 299,
"end": 300,
"ctxt": 0
},
"value": "p",
"optional": false
},
"value": {
"type": "ArrowFunctionExpression",
"span": {
"start": 302,
"end": 309,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 302,
"end": 303,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 307,
"end": 309,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 314,
"end": 322,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 314,
"end": 321,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 314,
"end": 319,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 314,
"end": 317,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 318,
"end": 319,
"ctxt": 0
},
"value": "m",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 341,
"end": 349,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 341,
"end": 348,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 341,
"end": 346,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 341,
"end": 344,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 345,
"end": 346,
"ctxt": 0
},
"value": "p",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
],
"interpreter": null
}