Socket
Socket
Sign inDemoInstall

@babel/helper-replace-supers

Package Overview
Dependencies
Maintainers
5
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-replace-supers - npm Package Compare versions

Comparing version 7.8.6 to 7.9.6

39

lib/index.js

@@ -116,7 +116,29 @@ "use strict";

get(superMember) {
return t.callExpression(this.file.addHelper("get"), [getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod), this.prop(superMember), t.thisExpression()]);
return this._get(superMember, this._getThisRefs());
},
_get(superMember, thisRefs) {
const proto = getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod);
return t.callExpression(this.file.addHelper("get"), [thisRefs.memo ? t.sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), thisRefs.this]);
},
_getThisRefs() {
if (!this.isDerivedConstructor) {
return {
this: t.thisExpression()
};
}
const thisRef = this.scope.generateDeclaredUidIdentifier("thisSuper");
return {
memo: t.assignmentExpression("=", thisRef, t.thisExpression()),
this: t.cloneNode(thisRef)
};
},
set(superMember, value) {
return t.callExpression(this.file.addHelper("set"), [getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod), this.prop(superMember), value, t.thisExpression(), t.booleanLiteral(superMember.isInStrictMode())]);
const thisRefs = this._getThisRefs();
const proto = getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod);
return t.callExpression(this.file.addHelper("set"), [thisRefs.memo ? t.sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), value, thisRefs.this, t.booleanLiteral(superMember.isInStrictMode())]);
},

@@ -129,3 +151,5 @@

call(superMember, args) {
return (0, _helperOptimiseCallExpression.default)(this.get(superMember), t.thisExpression(), args);
const thisRefs = this._getThisRefs();
return (0, _helperOptimiseCallExpression.default)(this._get(superMember, thisRefs), t.cloneNode(thisRefs.this), args);
}

@@ -181,2 +205,6 @@

return t.memberExpression(t.thisExpression(), prop, computed);
},
call(superMember, args) {
return (0, _helperOptimiseCallExpression.default)(this.get(superMember), t.thisExpression(), args);
}

@@ -190,2 +218,5 @@

this.methodPath = path;
this.isDerivedConstructor = path.isClassMethod({
kind: "constructor"
}) && !!opts.superRef;
this.isStatic = path.isObjectMethod() || path.node.static;

@@ -207,2 +238,4 @@ this.isPrivateMethod = path.isPrivate() && path.isMethod();

file: this.file,
scope: this.methodPath.scope,
isDerivedConstructor: this.isDerivedConstructor,
isStatic: this.isStatic,

@@ -209,0 +242,0 @@ isPrivateMethod: this.isPrivateMethod,

8

package.json
{
"name": "@babel/helper-replace-supers",
"version": "7.8.6",
"version": "7.9.6",
"description": "Helper function to replace supers",

@@ -14,6 +14,6 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-replace-supers",

"@babel/helper-optimise-call-expression": "^7.8.3",
"@babel/traverse": "^7.8.6",
"@babel/types": "^7.8.6"
"@babel/traverse": "^7.9.6",
"@babel/types": "^7.9.6"
},
"gitHead": "750d3dde3bd2d390819820fd22c05441da78751b"
"gitHead": "9c2846bcacc75aa931ea9d556950c2113765d43d"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc