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

1303 lines
33 KiB
JSON

{
"type": "Script",
"span": {
"start": 39,
"end": 738,
"ctxt": 0
},
"body": [
{
"type": "TsModuleDeclaration",
"span": {
"start": 39,
"end": 188,
"ctxt": 0
},
"declare": true,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 54,
"end": 57,
"ctxt": 0
},
"value": "JSX",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 58,
"end": 188,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 61,
"end": 82,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 71,
"end": 78,
"ctxt": 0
},
"value": "Element",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 79,
"end": 82,
"ctxt": 0
},
"body": []
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 84,
"end": 186,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 94,
"end": 111,
"ctxt": 0
},
"value": "IntrinsicElements",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 112,
"end": 186,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 116,
"end": 132,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 116,
"end": 121,
"ctxt": 0
},
"value": "test1",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 121,
"end": 131,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 123,
"end": 131,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 123,
"end": 131,
"ctxt": 0
},
"value": "Attribs1",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 135,
"end": 159,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 135,
"end": 140,
"ctxt": 0
},
"value": "test2",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 140,
"end": 158,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 142,
"end": 158,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 144,
"end": 156,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 144,
"end": 148,
"ctxt": 0
},
"value": "reqd",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 148,
"end": 156,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 150,
"end": 156,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 162,
"end": 183,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 162,
"end": 165,
"ctxt": 0
},
"value": "var",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 165,
"end": 182,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 167,
"end": 182,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 169,
"end": 180,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 169,
"end": 172,
"ctxt": 0
},
"value": "var",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 172,
"end": 180,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 174,
"end": 180,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
"typeParams": null
}
]
}
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 189,
"end": 237,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 199,
"end": 207,
"ctxt": 0
},
"value": "Attribs1",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 208,
"end": 237,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 211,
"end": 222,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 211,
"end": 212,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 213,
"end": 221,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 215,
"end": 221,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 224,
"end": 235,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 224,
"end": 225,
"ctxt": 0
},
"value": "s",
"optional": false
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 226,
"end": 234,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 228,
"end": 234,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 245,
"end": 261,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 245,
"end": 260,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 246,
"end": 251,
"ctxt": 0
},
"value": "test1",
"optional": false
},
"span": {
"start": 245,
"end": 260,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 252,
"end": 257,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 252,
"end": 253,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 254,
"end": 257,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 255,
"end": 256,
"ctxt": 0
},
"value": 0.0
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 268,
"end": 278,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 268,
"end": 277,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 269,
"end": 274,
"ctxt": 0
},
"value": "test1",
"optional": false
},
"span": {
"start": 268,
"end": 277,
"ctxt": 0
},
"attributes": [],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 285,
"end": 309,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 285,
"end": 308,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 286,
"end": 291,
"ctxt": 0
},
"value": "test1",
"optional": false
},
"span": {
"start": 285,
"end": 308,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 292,
"end": 305,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 292,
"end": 298,
"ctxt": 0
},
"value": "data-x",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 299,
"end": 305,
"ctxt": 0
},
"expression": {
"type": "BooleanLiteral",
"span": {
"start": 300,
"end": 304,
"ctxt": 0
},
"value": true
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 317,
"end": 339,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 317,
"end": 338,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 318,
"end": 323,
"ctxt": 0
},
"value": "test2",
"optional": false
},
"span": {
"start": 317,
"end": 338,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 324,
"end": 335,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 324,
"end": 328,
"ctxt": 0
},
"value": "reqd",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 329,
"end": 335,
"ctxt": 0
},
"value": "true",
"raw": "'true'"
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 346,
"end": 370,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 346,
"end": 369,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 347,
"end": 352,
"ctxt": 0
},
"value": "test2",
"optional": false
},
"span": {
"start": 346,
"end": 369,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 353,
"end": 366,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 353,
"end": 357,
"ctxt": 0
},
"value": "reqd",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 358,
"end": 366,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 359,
"end": 365,
"ctxt": 0
},
"value": "true",
"raw": "'true'"
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 388,
"end": 406,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 388,
"end": 405,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 389,
"end": 394,
"ctxt": 0
},
"value": "test1",
"optional": false
},
"span": {
"start": 388,
"end": 405,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 395,
"end": 402,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 395,
"end": 396,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 397,
"end": 402,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 398,
"end": 401,
"ctxt": 0
},
"value": "0",
"raw": "'0'"
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 435,
"end": 451,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 435,
"end": 450,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 436,
"end": 441,
"ctxt": 0
},
"value": "test1",
"optional": false
},
"span": {
"start": 435,
"end": 450,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 442,
"end": 447,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 442,
"end": 443,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 444,
"end": 447,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 445,
"end": 446,
"ctxt": 0
},
"value": 0.0
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 478,
"end": 496,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 478,
"end": 495,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 479,
"end": 484,
"ctxt": 0
},
"value": "test1",
"optional": false
},
"span": {
"start": 478,
"end": 495,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 485,
"end": 492,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 485,
"end": 486,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 487,
"end": 492,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 523,
"end": 540,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 523,
"end": 539,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 524,
"end": 529,
"ctxt": 0
},
"value": "test1",
"optional": false
},
"span": {
"start": 523,
"end": 539,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 530,
"end": 536,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 530,
"end": 531,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 532,
"end": 536,
"ctxt": 0
},
"value": "32",
"raw": "\"32\""
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 570,
"end": 589,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 570,
"end": 588,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 571,
"end": 576,
"ctxt": 0
},
"value": "test1",
"optional": false
},
"span": {
"start": 570,
"end": 588,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 577,
"end": 585,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 577,
"end": 580,
"ctxt": 0
},
"value": "var",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 581,
"end": 585,
"ctxt": 0
},
"value": "10",
"raw": "\"10\""
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 619,
"end": 629,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 619,
"end": 628,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 620,
"end": 625,
"ctxt": 0
},
"value": "test2",
"optional": false
},
"span": {
"start": 619,
"end": 628,
"ctxt": 0
},
"attributes": [],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 653,
"end": 673,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 653,
"end": 672,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 654,
"end": 659,
"ctxt": 0
},
"value": "test2",
"optional": false
},
"span": {
"start": 653,
"end": 672,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 660,
"end": 669,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 660,
"end": 664,
"ctxt": 0
},
"value": "reqd",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 665,
"end": 669,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 666,
"end": 668,
"ctxt": 0
},
"value": 10.0
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 720,
"end": 738,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 720,
"end": 737,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 721,
"end": 724,
"ctxt": 0
},
"value": "var",
"optional": false
},
"span": {
"start": 720,
"end": 737,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 725,
"end": 734,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 725,
"end": 728,
"ctxt": 0
},
"value": "var",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 729,
"end": 734,
"ctxt": 0
},
"value": "var",
"raw": "'var'"
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
}
}
],
"interpreter": null
}