rewrite this in shadowed functions inside native derived class constructors - fixes #1340

This commit is contained in:
Sebastian McKenzie
2015-04-24 11:20:29 +01:00
parent 74f04ed6a1
commit a36c1b4a92
3 changed files with 45 additions and 0 deletions

View File

@@ -37,6 +37,22 @@ var collectPropertyReferencesVisitor = {
}
};
var constructorVisitor = traverse.explode({
ThisExpression: {
enter(node, parent, scope, ref) {
return ref;
}
},
Function: {
enter(node) {
if (!node.shadow) {
this.skip();
}
}
}
});
var verifyConstructorVisitor = traverse.explode({
MethodDefinition: {
enter() {
@@ -581,6 +597,10 @@ class ClassTransformer {
fnPath.scope.rename(this.classRef.name);
}
if (this.isNativeSuper) {
fnPath.traverse(constructorVisitor, this.nativeSuperRef);
}
var construct = this.constructor;
var fn = method.value;