* Introduce scope tracking * Fix tests * Add new tests * Remove constructor-super check from transform as it is now in parser * Correctly handle class properties and class scope * Fix duplicate name check * Convert scope identifier storage to array * Enter a new scope in typescript module blocks * Add test for duplicate declaration * Rename error for duplicate exports * Treat class declarations as lexical declaration * Update whitelist * Add tests * Fix scope tracking for function declarations * Migrate try-catch duplicate error * Fix test * More tests * One more test * Make scope a separate class and fix review comments * Do not allow new.target in top scope arrow function * Correctly enter new scope for declare module and treat type aliases as lexical declarations * Tests for typescript scope tracking to not mark type aliases as duplicate * Fix flow scope tracking * Remove ident from test names as redundant * Add test case for var and function * Improve error messages * Improve literal regex
306 lines
7.0 KiB
JSON
306 lines
7.0 KiB
JSON
{
|
|
"type": "File",
|
|
"start": 0,
|
|
"end": 70,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 34
|
|
}
|
|
},
|
|
"program": {
|
|
"type": "Program",
|
|
"start": 0,
|
|
"end": 70,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 34
|
|
}
|
|
},
|
|
"sourceType": "module",
|
|
"interpreter": null,
|
|
"body": [
|
|
{
|
|
"type": "DeclareInterface",
|
|
"start": 0,
|
|
"end": 35,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 35
|
|
}
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"start": 18,
|
|
"end": 19,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 18
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 19
|
|
},
|
|
"identifierName": "I"
|
|
},
|
|
"name": "I"
|
|
},
|
|
"typeParameters": null,
|
|
"extends": [],
|
|
"implements": [],
|
|
"mixins": [],
|
|
"body": {
|
|
"type": "ObjectTypeAnnotation",
|
|
"start": 20,
|
|
"end": 35,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 20
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 35
|
|
}
|
|
},
|
|
"callProperties": [],
|
|
"properties": [
|
|
{
|
|
"type": "ObjectTypeProperty",
|
|
"start": 22,
|
|
"end": 33,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 22
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 33
|
|
}
|
|
},
|
|
"key": {
|
|
"type": "Identifier",
|
|
"start": 22,
|
|
"end": 25,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 22
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 25
|
|
},
|
|
"identifierName": "foo"
|
|
},
|
|
"name": "foo"
|
|
},
|
|
"static": false,
|
|
"proto": false,
|
|
"kind": "init",
|
|
"method": false,
|
|
"value": {
|
|
"type": "StringTypeAnnotation",
|
|
"start": 27,
|
|
"end": 33,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 27
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 33
|
|
}
|
|
}
|
|
},
|
|
"variance": null,
|
|
"optional": false
|
|
}
|
|
],
|
|
"indexers": [],
|
|
"internalSlots": [],
|
|
"exact": false
|
|
}
|
|
},
|
|
{
|
|
"type": "DeclareInterface",
|
|
"start": 36,
|
|
"end": 70,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 34
|
|
}
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"start": 54,
|
|
"end": 56,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 18
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 20
|
|
},
|
|
"identifierName": "I2"
|
|
},
|
|
"name": "I2"
|
|
},
|
|
"typeParameters": {
|
|
"type": "TypeParameterDeclaration",
|
|
"start": 56,
|
|
"end": 59,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 20
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 23
|
|
}
|
|
},
|
|
"params": [
|
|
{
|
|
"type": "TypeParameter",
|
|
"start": 57,
|
|
"end": 58,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 21
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 22
|
|
}
|
|
},
|
|
"name": "T",
|
|
"variance": null
|
|
}
|
|
]
|
|
},
|
|
"extends": [],
|
|
"implements": [],
|
|
"mixins": [],
|
|
"body": {
|
|
"type": "ObjectTypeAnnotation",
|
|
"start": 60,
|
|
"end": 70,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 24
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 34
|
|
}
|
|
},
|
|
"callProperties": [],
|
|
"properties": [
|
|
{
|
|
"type": "ObjectTypeProperty",
|
|
"start": 62,
|
|
"end": 68,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 26
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 32
|
|
}
|
|
},
|
|
"key": {
|
|
"type": "Identifier",
|
|
"start": 62,
|
|
"end": 65,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 26
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 29
|
|
},
|
|
"identifierName": "foo"
|
|
},
|
|
"name": "foo"
|
|
},
|
|
"static": false,
|
|
"proto": false,
|
|
"kind": "init",
|
|
"method": false,
|
|
"value": {
|
|
"type": "GenericTypeAnnotation",
|
|
"start": 67,
|
|
"end": 68,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 31
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 32
|
|
}
|
|
},
|
|
"typeParameters": null,
|
|
"id": {
|
|
"type": "Identifier",
|
|
"start": 67,
|
|
"end": 68,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 31
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 32
|
|
},
|
|
"identifierName": "T"
|
|
},
|
|
"name": "T"
|
|
}
|
|
},
|
|
"variance": null,
|
|
"optional": false
|
|
}
|
|
],
|
|
"indexers": [],
|
|
"internalSlots": [],
|
|
"exact": false
|
|
}
|
|
}
|
|
],
|
|
"directives": []
|
|
}
|
|
} |