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

1389 lines
35 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 30,
"end": 562,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 30,
"end": 53,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 34,
"end": 52,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 34,
"end": 36,
"ctxt": 0
},
"value": "id",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 36,
"end": 44,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 38,
"end": 44,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 47,
"end": 52,
"ctxt": 0
},
"value": 10000.0,
"raw": "10000"
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 54,
"end": 83,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 58,
"end": 82,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 58,
"end": 62,
"ctxt": 0
},
"value": "name",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 62,
"end": 70,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 64,
"end": 70,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": {
"type": "StringLiteral",
"span": {
"start": 73,
"end": 82,
"ctxt": 0
},
"value": "my name",
"raw": "\"my name\""
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 85,
"end": 141,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 89,
"end": 140,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 89,
"end": 95,
"ctxt": 0
},
"value": "person",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 95,
"end": 125,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 97,
"end": 125,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 99,
"end": 112,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 99,
"end": 103,
"ctxt": 0
},
"value": "name",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 103,
"end": 111,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 105,
"end": 111,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 113,
"end": 123,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 113,
"end": 115,
"ctxt": 0
},
"value": "id",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 115,
"end": 123,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 117,
"end": 123,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 128,
"end": 140,
"ctxt": 0
},
"properties": [
{
"type": "Identifier",
"span": {
"start": 130,
"end": 134,
"ctxt": 0
},
"value": "name",
"optional": false
},
{
"type": "Identifier",
"span": {
"start": 136,
"end": 138,
"ctxt": 0
},
"value": "id",
"optional": false
}
]
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 151,
"end": 154,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 155,
"end": 176,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 155,
"end": 176,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 158,
"end": 176,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 160,
"end": 176,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 162,
"end": 174,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 162,
"end": 166,
"ctxt": 0
},
"value": "name",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 166,
"end": 174,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 168,
"end": 174,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 142,
"end": 187,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 184,
"end": 187,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 177,
"end": 183,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 179,
"end": 183,
"ctxt": 0
},
"kind": "void"
}
}
},
{
"type": "EmptyStatement",
"span": {
"start": 187,
"end": 188,
"ctxt": 0
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 198,
"end": 201,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 202,
"end": 214,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 202,
"end": 214,
"ctxt": 0
},
"value": "name",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 206,
"end": 214,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 208,
"end": 214,
"ctxt": 0
},
"kind": "string"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 216,
"end": 226,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 216,
"end": 226,
"ctxt": 0
},
"value": "id",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 218,
"end": 226,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 220,
"end": 226,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 189,
"end": 252,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 228,
"end": 252,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 230,
"end": 250,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 237,
"end": 249,
"ctxt": 0
},
"properties": [
{
"type": "Identifier",
"span": {
"start": 239,
"end": 243,
"ctxt": 0
},
"value": "name",
"optional": false
},
{
"type": "Identifier",
"span": {
"start": 245,
"end": 247,
"ctxt": 0
},
"value": "id",
"optional": false
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 262,
"end": 266,
"ctxt": 0
},
"value": "bar1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 267,
"end": 279,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 267,
"end": 279,
"ctxt": 0
},
"value": "name",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 271,
"end": 279,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 273,
"end": 279,
"ctxt": 0
},
"kind": "string"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 281,
"end": 291,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 281,
"end": 291,
"ctxt": 0
},
"value": "id",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 283,
"end": 291,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 285,
"end": 291,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 253,
"end": 313,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 293,
"end": 313,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 295,
"end": 311,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 302,
"end": 310,
"ctxt": 0
},
"properties": [
{
"type": "Identifier",
"span": {
"start": 304,
"end": 308,
"ctxt": 0
},
"value": "name",
"optional": false
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 323,
"end": 326,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 327,
"end": 339,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 327,
"end": 339,
"ctxt": 0
},
"value": "name",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 331,
"end": 339,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 333,
"end": 339,
"ctxt": 0
},
"kind": "string"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 341,
"end": 351,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 341,
"end": 351,
"ctxt": 0
},
"value": "id",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 343,
"end": 351,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 345,
"end": 351,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 314,
"end": 407,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 383,
"end": 407,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 385,
"end": 405,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 392,
"end": 404,
"ctxt": 0
},
"properties": [
{
"type": "Identifier",
"span": {
"start": 394,
"end": 398,
"ctxt": 0
},
"value": "name",
"optional": false
},
{
"type": "Identifier",
"span": {
"start": 400,
"end": 402,
"ctxt": 0
},
"value": "id",
"optional": false
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 352,
"end": 382,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 354,
"end": 382,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 356,
"end": 369,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 356,
"end": 360,
"ctxt": 0
},
"value": "name",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 360,
"end": 368,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 362,
"end": 368,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 370,
"end": 380,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 370,
"end": 372,
"ctxt": 0
},
"value": "id",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 372,
"end": 380,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 374,
"end": 380,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 409,
"end": 421,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 409,
"end": 420,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 409,
"end": 412,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 413,
"end": 419,
"ctxt": 0
},
"value": "person",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 422,
"end": 452,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 426,
"end": 451,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 426,
"end": 433,
"ctxt": 0
},
"value": "person1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 436,
"end": 451,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 436,
"end": 439,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 440,
"end": 447,
"ctxt": 0
},
"value": "Hello",
"raw": "\"Hello\""
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 449,
"end": 450,
"ctxt": 0
},
"value": 5.0,
"raw": "5"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 453,
"end": 501,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 457,
"end": 500,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 457,
"end": 464,
"ctxt": 0
},
"value": "person2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 464,
"end": 482,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 466,
"end": 482,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 468,
"end": 480,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 468,
"end": 472,
"ctxt": 0
},
"value": "name",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 472,
"end": 480,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 474,
"end": 480,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "CallExpression",
"span": {
"start": 485,
"end": 500,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 485,
"end": 488,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 489,
"end": 496,
"ctxt": 0
},
"value": "Hello",
"raw": "\"Hello\""
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 498,
"end": 499,
"ctxt": 0
},
"value": 5.0,
"raw": "5"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 502,
"end": 562,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 506,
"end": 561,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 506,
"end": 513,
"ctxt": 0
},
"value": "person3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 513,
"end": 543,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 515,
"end": 543,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 517,
"end": 530,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 517,
"end": 521,
"ctxt": 0
},
"value": "name",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 521,
"end": 529,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 523,
"end": 529,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 531,
"end": 541,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 531,
"end": 533,
"ctxt": 0
},
"value": "id",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 533,
"end": 541,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 535,
"end": 541,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "CallExpression",
"span": {
"start": 546,
"end": 561,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 546,
"end": 549,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 550,
"end": 557,
"ctxt": 0
},
"value": "Hello",
"raw": "\"Hello\""
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 559,
"end": 560,
"ctxt": 0
},
"value": 5.0,
"raw": "5"
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
],
"interpreter": null
}