swc/crates/swc_ecma_parser/tests/tsc/invalidBooleanAssignments.json
2022-02-04 17:08:38 +09:00

1172 lines
27 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 391,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 0,
"end": 13,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 4,
"end": 12,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 4,
"end": 5,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BooleanLiteral",
"span": {
"start": 8,
"end": 12,
"ctxt": 0
},
"value": true
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 17,
"end": 35,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 21,
"end": 34,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 22,
"end": 30,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 24,
"end": 30,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 33,
"end": 34,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 37,
"end": 55,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 41,
"end": 54,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 41,
"end": 42,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 42,
"end": 50,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 44,
"end": 50,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 53,
"end": 54,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 57,
"end": 73,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 61,
"end": 72,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 61,
"end": 62,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 62,
"end": 68,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 64,
"end": 68,
"ctxt": 0
},
"kind": "void"
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 71,
"end": 72,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 75,
"end": 103,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 79,
"end": 102,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 79,
"end": 80,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 80,
"end": 98,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeQuery",
"span": {
"start": 82,
"end": 98,
"ctxt": 0
},
"exprName": {
"type": "Identifier",
"span": {
"start": 89,
"end": 98,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 101,
"end": 102,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "TsEnumDeclaration",
"span": {
"start": 107,
"end": 119,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 112,
"end": 113,
"ctxt": 0
},
"value": "E",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 116,
"end": 117,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 116,
"end": 117,
"ctxt": 0
},
"value": "A",
"optional": false
},
"init": null
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 121,
"end": 134,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 125,
"end": 133,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 125,
"end": 126,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 126,
"end": 129,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 128,
"end": 129,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 128,
"end": 129,
"ctxt": 0
},
"value": "E",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 132,
"end": 133,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 144,
"end": 145,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 138,
"end": 161,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 148,
"end": 159,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 148,
"end": 151,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 151,
"end": 159,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 153,
"end": 159,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 163,
"end": 176,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 167,
"end": 175,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 167,
"end": 168,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 168,
"end": 171,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 170,
"end": 171,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 170,
"end": 171,
"ctxt": 0
},
"value": "C",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 174,
"end": 175,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 180,
"end": 207,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 190,
"end": 191,
"ctxt": 0
},
"value": "I",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 192,
"end": 207,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 194,
"end": 205,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 194,
"end": 197,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 197,
"end": 205,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 199,
"end": 205,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 209,
"end": 222,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 213,
"end": 221,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 213,
"end": 214,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 214,
"end": 217,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 216,
"end": 217,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 216,
"end": 217,
"ctxt": 0
},
"value": "I",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 220,
"end": 221,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 226,
"end": 252,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 230,
"end": 251,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 230,
"end": 231,
"ctxt": 0
},
"value": "h",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 231,
"end": 247,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 233,
"end": 247,
"ctxt": 0
},
"members": [
{
"type": "TsCallSignatureDeclaration",
"span": {
"start": 235,
"end": 245,
"ctxt": 0
},
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 237,
"end": 245,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 239,
"end": 245,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 250,
"end": 251,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 254,
"end": 289,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 258,
"end": 288,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 258,
"end": 260,
"ctxt": 0
},
"value": "h2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 260,
"end": 284,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 262,
"end": 284,
"ctxt": 0
},
"members": [
{
"type": "TsMethodSignature",
"span": {
"start": 264,
"end": 282,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 264,
"end": 272,
"ctxt": 0
},
"value": "toString",
"optional": false
},
"computed": false,
"optional": false,
"params": [],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 274,
"end": 282,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 276,
"end": 282,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 287,
"end": 288,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 305,
"end": 335,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 312,
"end": 313,
"ctxt": 0
},
"value": "M",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 314,
"end": 335,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 316,
"end": 333,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 323,
"end": 333,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 327,
"end": 332,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 327,
"end": 328,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 331,
"end": 332,
"ctxt": 0
},
"value": 1.0
},
"definite": false
}
]
}
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 337,
"end": 343,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 337,
"end": 342,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 337,
"end": 338,
"ctxt": 0
},
"value": "M",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 341,
"end": 342,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 356,
"end": 357,
"ctxt": 0
},
"value": "i",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 361,
"end": 365,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 361,
"end": 365,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 362,
"end": 365,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 364,
"end": 365,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 364,
"end": 365,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 347,
"end": 383,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 367,
"end": 383,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 374,
"end": 380,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 374,
"end": 379,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 374,
"end": 375,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 378,
"end": 379,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 357,
"end": 360,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 358,
"end": 359,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 358,
"end": 359,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 385,
"end": 391,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 385,
"end": 390,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 385,
"end": 386,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 389,
"end": 390,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
],
"interpreter": null
}