rename replaceInstanceSuperReferences to replaceSuperReferences in classes transformer and add breaks on method definitions
This commit is contained in:
@@ -136,7 +136,7 @@ Class.prototype.buildBody = function () {
|
||||
for (var i in classBody) {
|
||||
var node = classBody[i];
|
||||
if (t.isMethodDefinition(node)) {
|
||||
this.replaceInstanceSuperReferences(node);
|
||||
this.replaceSuperReferences(node);
|
||||
|
||||
if (node.key.name === "constructor") {
|
||||
this.pushConstructor(node);
|
||||
@@ -301,7 +301,7 @@ Class.prototype.looseSuperProperty = function (methodNode, id, parent) {
|
||||
* @param {Node} methodNode MethodDefinition
|
||||
*/
|
||||
|
||||
Class.prototype.replaceInstanceSuperReferences = function (methodNode) {
|
||||
Class.prototype.replaceSuperReferences = function (methodNode) {
|
||||
var method = methodNode.value;
|
||||
var self = this;
|
||||
|
||||
@@ -324,6 +324,11 @@ Class.prototype.replaceInstanceSuperReferences = function (methodNode) {
|
||||
return this.skip();
|
||||
}
|
||||
|
||||
if (t.isProperty(node, { method: true }) || t.isMethodDefinition(node)) {
|
||||
// break on object methods
|
||||
return this.skip();
|
||||
}
|
||||
|
||||
var getThisReference = function () {
|
||||
if (topLevel) {
|
||||
// top level so `this` is the instance
|
||||
|
||||
Reference in New Issue
Block a user