swc/crates/swc_ecma_parser/tests/tsc/objectLiteralShorthandPropertiesAssignment.json
2022-03-22 07:54:08 +00:00

1385 lines
35 KiB
JSON

{
"type": "Script",
"span": {
"start": 13,
"end": 544,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 13,
"end": 36,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 17,
"end": 35,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 17,
"end": 19,
"ctxt": 0
},
"value": "id",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 19,
"end": 27,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 21,
"end": 27,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 30,
"end": 35,
"ctxt": 0
},
"value": 10000.0
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 37,
"end": 66,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 41,
"end": 65,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 41,
"end": 45,
"ctxt": 0
},
"value": "name",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 45,
"end": 53,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 47,
"end": 53,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": {
"type": "StringLiteral",
"span": {
"start": 56,
"end": 65,
"ctxt": 0
},
"value": "my name",
"raw": "\"my name\""
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 68,
"end": 124,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 72,
"end": 123,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 72,
"end": 78,
"ctxt": 0
},
"value": "person",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 78,
"end": 108,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 80,
"end": 108,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 82,
"end": 95,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 82,
"end": 86,
"ctxt": 0
},
"value": "name",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 86,
"end": 94,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 88,
"end": 94,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 96,
"end": 106,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 96,
"end": 98,
"ctxt": 0
},
"value": "id",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 98,
"end": 106,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 100,
"end": 106,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 111,
"end": 123,
"ctxt": 0
},
"properties": [
{
"type": "Identifier",
"span": {
"start": 113,
"end": 117,
"ctxt": 0
},
"value": "name",
"optional": false
},
{
"type": "Identifier",
"span": {
"start": 119,
"end": 121,
"ctxt": 0
},
"value": "id",
"optional": false
}
]
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 134,
"end": 137,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 139,
"end": 159,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 139,
"end": 159,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 142,
"end": 159,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 143,
"end": 159,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 145,
"end": 157,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 145,
"end": 149,
"ctxt": 0
},
"value": "name",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 149,
"end": 157,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 151,
"end": 157,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 125,
"end": 170,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 167,
"end": 170,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 160,
"end": 166,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 162,
"end": 166,
"ctxt": 0
},
"kind": "void"
}
}
},
{
"type": "EmptyStatement",
"span": {
"start": 170,
"end": 171,
"ctxt": 0
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 181,
"end": 184,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 185,
"end": 197,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 185,
"end": 197,
"ctxt": 0
},
"value": "name",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 189,
"end": 197,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 191,
"end": 197,
"ctxt": 0
},
"kind": "string"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 199,
"end": 209,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 199,
"end": 209,
"ctxt": 0
},
"value": "id",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 201,
"end": 209,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 203,
"end": 209,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 172,
"end": 235,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 211,
"end": 235,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 213,
"end": 233,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 220,
"end": 232,
"ctxt": 0
},
"properties": [
{
"type": "Identifier",
"span": {
"start": 222,
"end": 226,
"ctxt": 0
},
"value": "name",
"optional": false
},
{
"type": "Identifier",
"span": {
"start": 228,
"end": 230,
"ctxt": 0
},
"value": "id",
"optional": false
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 245,
"end": 249,
"ctxt": 0
},
"value": "bar1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 250,
"end": 262,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 250,
"end": 262,
"ctxt": 0
},
"value": "name",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 254,
"end": 262,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 256,
"end": 262,
"ctxt": 0
},
"kind": "string"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 264,
"end": 274,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 264,
"end": 274,
"ctxt": 0
},
"value": "id",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 266,
"end": 274,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 268,
"end": 274,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 236,
"end": 296,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 276,
"end": 296,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 278,
"end": 294,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 285,
"end": 293,
"ctxt": 0
},
"properties": [
{
"type": "Identifier",
"span": {
"start": 287,
"end": 291,
"ctxt": 0
},
"value": "name",
"optional": false
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 306,
"end": 309,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 310,
"end": 322,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 310,
"end": 322,
"ctxt": 0
},
"value": "name",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 314,
"end": 322,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 316,
"end": 322,
"ctxt": 0
},
"kind": "string"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 324,
"end": 334,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 324,
"end": 334,
"ctxt": 0
},
"value": "id",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 326,
"end": 334,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 328,
"end": 334,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 297,
"end": 390,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 366,
"end": 390,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 368,
"end": 388,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 375,
"end": 387,
"ctxt": 0
},
"properties": [
{
"type": "Identifier",
"span": {
"start": 377,
"end": 381,
"ctxt": 0
},
"value": "name",
"optional": false
},
{
"type": "Identifier",
"span": {
"start": 383,
"end": 385,
"ctxt": 0
},
"value": "id",
"optional": false
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 335,
"end": 365,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 337,
"end": 365,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 339,
"end": 352,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 339,
"end": 343,
"ctxt": 0
},
"value": "name",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 343,
"end": 351,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 345,
"end": 351,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 353,
"end": 363,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 353,
"end": 355,
"ctxt": 0
},
"value": "id",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 355,
"end": 363,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 357,
"end": 363,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 392,
"end": 404,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 392,
"end": 403,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 392,
"end": 395,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 396,
"end": 402,
"ctxt": 0
},
"value": "person",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 405,
"end": 435,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 409,
"end": 434,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 409,
"end": 416,
"ctxt": 0
},
"value": "person1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 419,
"end": 434,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 419,
"end": 422,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 423,
"end": 430,
"ctxt": 0
},
"value": "Hello",
"raw": "\"Hello\""
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 432,
"end": 433,
"ctxt": 0
},
"value": 5.0
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 436,
"end": 484,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 440,
"end": 483,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 440,
"end": 447,
"ctxt": 0
},
"value": "person2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 447,
"end": 465,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 449,
"end": 465,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 451,
"end": 463,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 451,
"end": 455,
"ctxt": 0
},
"value": "name",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 455,
"end": 463,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 457,
"end": 463,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "CallExpression",
"span": {
"start": 468,
"end": 483,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 468,
"end": 471,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 472,
"end": 479,
"ctxt": 0
},
"value": "Hello",
"raw": "\"Hello\""
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 481,
"end": 482,
"ctxt": 0
},
"value": 5.0
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 485,
"end": 544,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 489,
"end": 543,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 489,
"end": 496,
"ctxt": 0
},
"value": "person3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 496,
"end": 525,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 498,
"end": 525,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 500,
"end": 513,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 500,
"end": 504,
"ctxt": 0
},
"value": "name",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 504,
"end": 512,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 506,
"end": 512,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 514,
"end": 523,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 514,
"end": 516,
"ctxt": 0
},
"value": "id",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 516,
"end": 523,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 517,
"end": 523,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "CallExpression",
"span": {
"start": 528,
"end": 543,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 528,
"end": 531,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 532,
"end": 539,
"ctxt": 0
},
"value": "Hello",
"raw": "\"Hello\""
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 541,
"end": 542,
"ctxt": 0
},
"value": 5.0
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
],
"interpreter": null
}