[parser] Disallow duplicate and undeclared private names (#10456)
* [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
This commit is contained in:
@@ -391,14 +391,8 @@ export default class Tokenizer extends LocationParser {
|
||||
}
|
||||
|
||||
if (
|
||||
(this.hasPlugin("classPrivateProperties") ||
|
||||
this.hasPlugin("classPrivateMethods")) &&
|
||||
this.state.classLevel > 0
|
||||
) {
|
||||
++this.state.pos;
|
||||
this.finishToken(tt.hash);
|
||||
return;
|
||||
} else if (
|
||||
this.hasPlugin("classPrivateProperties") ||
|
||||
this.hasPlugin("classPrivateMethods") ||
|
||||
this.getPluginOption("pipelineOperator", "proposal") === "smart"
|
||||
) {
|
||||
this.finishOp(tt.hash, 1);
|
||||
|
||||
@@ -77,9 +77,6 @@ export default class State {
|
||||
soloAwait: boolean = false;
|
||||
inFSharpPipelineDirectBody: boolean = false;
|
||||
|
||||
// Check whether we are in a (nested) class or not.
|
||||
classLevel: number = 0;
|
||||
|
||||
// Labels in scope.
|
||||
labels: Array<{
|
||||
kind: ?("loop" | "switch"),
|
||||
|
||||
Reference in New Issue
Block a user