Fix redeclaring private in nested class's superClass (#11424)

If a nested class's `superClass` redeclares the outer class's private field and access it in a computed key, that should fail.

Follow up to #11405.
This commit is contained in:
Justin Ridgewell
2020-04-20 10:54:14 -04:00
committed by GitHub
parent 0aa5a47196
commit d6efed5b22
17 changed files with 415 additions and 2 deletions

View File

@@ -103,7 +103,6 @@ const privateNameVisitor = {
// This class redeclares some private field. We need to process the outer
// environment with access to all the outer privates, then we can process
// the inner environment with only the still-visible outer privates.
path.get("superClass").traverse(privateNameVisitor, this);
path.get("body").traverse(privateNameNestedVisitor, {
...this,
redeclared,
@@ -115,7 +114,7 @@ const privateNameVisitor = {
// We'll eventually hit this class node again with the overall Class
// Features visitor, which'll process the redeclared privates.
path.skip();
path.skipKey("body");
},
};