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

474 lines
12 KiB
JSON

{
"type": "Script",
"span": {
"start": 14,
"end": 195,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 14,
"end": 37,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 18,
"end": 36,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 18,
"end": 20,
"ctxt": 0
},
"value": "id",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 20,
"end": 28,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 22,
"end": 28,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 31,
"end": 36,
"ctxt": 0
},
"value": 10000.0,
"raw": "10000"
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 38,
"end": 67,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 42,
"end": 66,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 42,
"end": 46,
"ctxt": 0
},
"value": "name",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 46,
"end": 54,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 48,
"end": 54,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": {
"type": "StringLiteral",
"span": {
"start": 57,
"end": 66,
"ctxt": 0
},
"value": "my name",
"raw": "\"my name\""
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 69,
"end": 95,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 73,
"end": 94,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 73,
"end": 79,
"ctxt": 0
},
"value": "person",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 82,
"end": 94,
"ctxt": 0
},
"properties": [
{
"type": "Identifier",
"span": {
"start": 84,
"end": 88,
"ctxt": 0
},
"value": "name",
"optional": false
},
{
"type": "Identifier",
"span": {
"start": 90,
"end": 92,
"ctxt": 0
},
"value": "id",
"optional": false
}
]
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 106,
"end": 109,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 110,
"end": 141,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 110,
"end": 141,
"ctxt": 0
},
"value": "p",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 111,
"end": 141,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 113,
"end": 141,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 115,
"end": 128,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 115,
"end": 119,
"ctxt": 0
},
"value": "name",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 119,
"end": 127,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 121,
"end": 127,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 129,
"end": 139,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 129,
"end": 131,
"ctxt": 0
},
"value": "id",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 131,
"end": 139,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 133,
"end": 139,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 97,
"end": 146,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 143,
"end": 146,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 147,
"end": 159,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 147,
"end": 158,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 147,
"end": 150,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 151,
"end": 157,
"ctxt": 0
},
"value": "person",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 162,
"end": 195,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 166,
"end": 194,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 166,
"end": 169,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 172,
"end": 194,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 174,
"end": 178,
"ctxt": 0
},
"value": "name",
"optional": false
},
"value": {
"type": "Identifier",
"span": {
"start": 180,
"end": 184,
"ctxt": 0
},
"value": "name",
"optional": false
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 186,
"end": 188,
"ctxt": 0
},
"value": "id",
"optional": false
},
"value": {
"type": "Identifier",
"span": {
"start": 190,
"end": 192,
"ctxt": 0
},
"value": "id",
"optional": false
}
}
]
},
"definite": false
}
]
}
],
"interpreter": null
}