@babel/helper-replace-supers
Advanced tools
Comparing version 7.22.20 to 7.24.1
@@ -91,14 +91,8 @@ "use strict"; | ||
const proto = getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod); | ||
return callExpression(this.file.addHelper("get"), [thisRefs.memo ? sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), thisRefs.this]); | ||
return callExpression(this.file.addHelper("get"), [thisRefs.needAccessFirst ? sequenceExpression([thisRefs.this, proto]) : proto, this.prop(superMember), thisRefs.this]); | ||
}, | ||
_getThisRefs() { | ||
if (!this.isDerivedConstructor) { | ||
return { | ||
this: thisExpression() | ||
}; | ||
} | ||
const thisRef = this.scope.generateDeclaredUidIdentifier("thisSuper"); | ||
return { | ||
memo: assignmentExpression("=", thisRef, thisExpression()), | ||
this: cloneNode(thisRef) | ||
needAccessFirst: this.isDerivedConstructor, | ||
this: thisExpression() | ||
}; | ||
@@ -109,3 +103,3 @@ }, | ||
const proto = getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod); | ||
return callExpression(this.file.addHelper("set"), [thisRefs.memo ? sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), value, thisRefs.this, booleanLiteral(superMember.isInStrictMode())]); | ||
return callExpression(this.file.addHelper("set"), [thisRefs.needAccessFirst ? sequenceExpression([thisRefs.this, proto]) : proto, this.prop(superMember), value, thisRefs.this, booleanLiteral(superMember.isInStrictMode())]); | ||
}, | ||
@@ -209,4 +203,7 @@ destructureSet(superMember) { | ||
replace() { | ||
const { | ||
methodPath | ||
} = this; | ||
if (this.opts.refToPreserve) { | ||
this.methodPath.traverse(unshadowSuperBindingVisitor, { | ||
methodPath.traverse(unshadowSuperBindingVisitor, { | ||
refName: this.opts.refToPreserve.name | ||
@@ -216,3 +213,10 @@ }); | ||
const handler = this.constantSuper ? looseHandlers : specHandlers; | ||
(0, _helperMemberExpressionToFunctions.default)(this.methodPath, visitor, Object.assign({ | ||
visitor.shouldSkip = path => { | ||
if (path.parentPath === methodPath) { | ||
if (path.parentKey === "decorators" || path.parentKey === "key") { | ||
return true; | ||
} | ||
} | ||
}; | ||
(0, _helperMemberExpressionToFunctions.default)(methodPath, visitor, Object.assign({ | ||
file: this.file, | ||
@@ -219,0 +223,0 @@ scope: this.methodPath.scope, |
{ | ||
"name": "@babel/helper-replace-supers", | ||
"version": "7.22.20", | ||
"version": "7.24.1", | ||
"description": "Helper function to replace supers", | ||
@@ -18,7 +18,7 @@ "repository": { | ||
"@babel/helper-environment-visitor": "^7.22.20", | ||
"@babel/helper-member-expression-to-functions": "^7.22.15", | ||
"@babel/helper-member-expression-to-functions": "^7.23.0", | ||
"@babel/helper-optimise-call-expression": "^7.22.5" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.22.20" | ||
"@babel/core": "^7.24.1" | ||
}, | ||
@@ -25,0 +25,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32172
229