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

487 lines
15 KiB
JSON

{
"type": "Script",
"span": {
"start": 54,
"end": 372,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 71,
"end": 90,
"ctxt": 0
},
"value": "connectionFromArray",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 91,
"end": 106,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 91,
"end": 106,
"ctxt": 0
},
"value": "objects",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 98,
"end": 106,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 100,
"end": 106,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 108,
"end": 117,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 108,
"end": 117,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 112,
"end": 117,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 114,
"end": 117,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"decorators": [],
"span": {
"start": 54,
"end": 123,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 118,
"end": 122,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 120,
"end": 122,
"ctxt": 0
},
"members": []
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 133,
"end": 147,
"ctxt": 0
},
"value": "rootConnection",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 148,
"end": 160,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 148,
"end": 160,
"ctxt": 0
},
"value": "name",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 152,
"end": 160,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 154,
"end": 160,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 124,
"end": 348,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 162,
"end": 348,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 166,
"end": 346,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 173,
"end": 345,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 179,
"end": 186,
"ctxt": 0
},
"value": "resolve",
"optional": false
},
"value": {
"type": "ArrowFunctionExpression",
"span": {
"start": 188,
"end": 341,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 195,
"end": 202,
"ctxt": 0
},
"value": "context",
"optional": false,
"typeAnnotation": null
},
{
"type": "Identifier",
"span": {
"start": 204,
"end": 208,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 213,
"end": 341,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 223,
"end": 265,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 229,
"end": 264,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 229,
"end": 240,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 231,
"end": 238,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 231,
"end": 238,
"ctxt": 0
},
"value": "objects",
"optional": false
},
"value": null
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "AwaitExpression",
"span": {
"start": 243,
"end": 264,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 249,
"end": 264,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 251,
"end": 258,
"ctxt": 0
},
"value": "objects",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 260,
"end": 262,
"ctxt": 0
},
"value": 12.0
}
}
]
}
},
"definite": false
}
]
},
{
"type": "ReturnStatement",
"span": {
"start": 272,
"end": 335,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 279,
"end": 334,
"ctxt": 0
},
"properties": [
{
"type": "SpreadElement",
"spread": {
"start": 289,
"end": 292,
"ctxt": 0
},
"arguments": {
"type": "CallExpression",
"span": {
"start": 292,
"end": 326,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 292,
"end": 311,
"ctxt": 0
},
"value": "connectionFromArray",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 312,
"end": 319,
"ctxt": 0
},
"value": "objects",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 321,
"end": 325,
"ctxt": 0
},
"value": "args",
"optional": false
}
}
],
"typeArguments": null
}
}
]
}
}
]
},
"async": true,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 349,
"end": 372,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 349,
"end": 371,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 349,
"end": 363,
"ctxt": 0
},
"value": "rootConnection",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 364,
"end": 370,
"ctxt": 0
},
"value": "test",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}