@babel/helper-replace-supers
Advanced tools
+36
-3
@@ -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, |
+4
-4
| { | ||
| "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" | ||
| } |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
9408
12.23%195
16.07%Updated
Updated