produce new MemberExpression in a CallExpression super identifier instead of mutating the property

This commit is contained in:
Sebastian McKenzie
2014-11-12 01:51:57 +11:00
parent 64f6e4a0c5
commit b8cac9787e

View File

@@ -232,8 +232,8 @@ Class.prototype.replaceInstanceSuperReferences = function (methodNode) {
if (!t.isMemberExpression(callee)) return;
if (callee.object.name !== "super") return;
// super.test(); -> ClassName.prototype.MethodName.call(this);
callee.property.name = callee.property.name + ".call";
// super.test(); -> ClassName.prototype.MethodName.call(this);
callee.property = t.memberExpression(callee.property, t.identifier("call"));
node.arguments.unshift(t.thisExpression());
}
});