* [parser] Add private names tracking to Scope - Disallow duplicate private names - Disallow undeclared private names * Update tests * Test all possible duplications * Test undeclared private names * Better error message for top-level private names * Fix flow * Update test262 whitelist * Update fixtures * Update flow whitelist * Remove old output.json * Move ClassScopeHandler to a separate class * Make the code readable
247 lines
5.8 KiB
JSON
247 lines
5.8 KiB
JSON
{
|
|
"type": "File",
|
|
"start": 0,
|
|
"end": 36,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 4,
|
|
"column": 1
|
|
}
|
|
},
|
|
"errors": [
|
|
"SyntaxError: Duplicate private name #x (3:2)"
|
|
],
|
|
"program": {
|
|
"type": "Program",
|
|
"start": 0,
|
|
"end": 36,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 4,
|
|
"column": 1
|
|
}
|
|
},
|
|
"sourceType": "script",
|
|
"interpreter": null,
|
|
"body": [
|
|
{
|
|
"type": "ClassDeclaration",
|
|
"start": 0,
|
|
"end": 36,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 4,
|
|
"column": 1
|
|
}
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"start": 6,
|
|
"end": 7,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 6
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 7
|
|
},
|
|
"identifierName": "A"
|
|
},
|
|
"name": "A"
|
|
},
|
|
"superClass": null,
|
|
"body": {
|
|
"type": "ClassBody",
|
|
"start": 8,
|
|
"end": 36,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 8
|
|
},
|
|
"end": {
|
|
"line": 4,
|
|
"column": 1
|
|
}
|
|
},
|
|
"body": [
|
|
{
|
|
"type": "ClassPrivateMethod",
|
|
"start": 12,
|
|
"end": 24,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 2
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 14
|
|
}
|
|
},
|
|
"static": false,
|
|
"key": {
|
|
"type": "PrivateName",
|
|
"start": 16,
|
|
"end": 18,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 6
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 8
|
|
}
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"start": 17,
|
|
"end": 18,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 7
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 8
|
|
},
|
|
"identifierName": "x"
|
|
},
|
|
"name": "x"
|
|
}
|
|
},
|
|
"computed": false,
|
|
"kind": "set",
|
|
"id": null,
|
|
"generator": false,
|
|
"async": false,
|
|
"params": [
|
|
{
|
|
"type": "Identifier",
|
|
"start": 19,
|
|
"end": 20,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 9
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 10
|
|
},
|
|
"identifierName": "_"
|
|
},
|
|
"name": "_"
|
|
}
|
|
],
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"start": 22,
|
|
"end": 24,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 12
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 14
|
|
}
|
|
},
|
|
"body": [],
|
|
"directives": []
|
|
}
|
|
},
|
|
{
|
|
"type": "ClassPrivateMethod",
|
|
"start": 27,
|
|
"end": 34,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 2
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 9
|
|
}
|
|
},
|
|
"static": false,
|
|
"key": {
|
|
"type": "PrivateName",
|
|
"start": 27,
|
|
"end": 29,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 2
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 4
|
|
}
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"start": 28,
|
|
"end": 29,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 3
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 4
|
|
},
|
|
"identifierName": "x"
|
|
},
|
|
"name": "x"
|
|
}
|
|
},
|
|
"kind": "method",
|
|
"id": null,
|
|
"generator": false,
|
|
"async": false,
|
|
"params": [],
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"start": 32,
|
|
"end": 34,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 7
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 9
|
|
}
|
|
},
|
|
"body": [],
|
|
"directives": []
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"directives": []
|
|
}
|
|
} |