Correctly access shadowed class binding in super.* (#12544)
* rename own binding inside methods if it collides with class ref. fix #11994 * fix name collisions in constructor * do fix name collisions in constructor * move logic in ReplaceSupers * fix tests of helper-create-class-features-plugin * remove replaceSupers in pushConstructor * use environmentVisitor * skip classLike nodes * fix super ref in computed key
This commit is contained in:
@@ -174,6 +174,7 @@ export default function transformClass(
|
||||
superRef: classState.superName,
|
||||
isLoose: classState.isLoose,
|
||||
file: classState.file,
|
||||
refToPreserve: classState.classRef,
|
||||
});
|
||||
|
||||
replaceSupers.replace();
|
||||
@@ -496,11 +497,6 @@ export default function transformClass(
|
||||
method: { type: "ClassMethod" },
|
||||
path: NodePath,
|
||||
) {
|
||||
// https://github.com/babel/babel/issues/1077
|
||||
if (path.scope.hasOwnBinding(classState.classRef.name)) {
|
||||
path.scope.rename(classState.classRef.name);
|
||||
}
|
||||
|
||||
setState({
|
||||
userConstructorPath: path,
|
||||
userConstructor: method,
|
||||
|
||||
Reference in New Issue
Block a user