Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-helper-replace-supers

Package Overview
Dependencies
Maintainers
4
Versions
51
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.0.0-alpha.15 to 7.0.0-alpha.16

33

lib/index.js

@@ -22,10 +22,12 @@ "use strict";

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var HARDCORE_THIS_REF = new WeakSet();
var HARDCORE_THIS_REF = Symbol();
function isIllegalBareSuper(node, parent) {
if (!t.isSuper(node)) return false;
if (t.isMemberExpression(parent, { computed: false })) return false;
if (t.isCallExpression(parent, { callee: node })) return false;
if (t.isMemberExpression(parent, {
computed: false
})) return false;
if (t.isCallExpression(parent, {
callee: node
})) return false;
return true;

@@ -40,3 +42,2 @@ }

var targetRef = isStatic ? objectRef : t.memberExpression(objectRef, t.identifier("prototype"));
return t.logicalExpression("||", t.memberExpression(targetRef, t.identifier("__proto__")), t.callExpression(t.memberExpression(t.identifier("Object"), t.identifier("getPrototypeOf")), [targetRef]));

@@ -53,3 +54,3 @@ }

ThisExpression: function ThisExpression(path, state) {
if (!path.node[HARDCORE_THIS_REF]) {
if (!HARDCORE_THIS_REF.has(path.node)) {
state.thises.push(path);

@@ -61,5 +62,3 @@ }

if (state.isLoose) callback = state.looseHandle;
var isBareSuper = path.isCallExpression() && path.get("callee").isSuper();
var result = callback.call(state, path);

@@ -92,5 +91,2 @@

var inClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
_classCallCheck(this, ReplaceSupers);
this.forceSuperMemoisation = opts.forceSuperMemoisation;

@@ -107,3 +103,2 @@ this.methodPath = opts.methodPath;

this.opts = opts;
this.bareSupers = [];

@@ -136,3 +131,5 @@ this.returns = [];

return;
} else if (t.isCallExpression(parent, { callee: id })) {
} else if (t.isCallExpression(parent, {
callee: id
})) {
return;

@@ -148,2 +145,3 @@ } else if (t.isMemberExpression(parent) && !methodNode.static) {

var node = path.node;
if (path.isSuper()) {

@@ -155,3 +153,2 @@ return this.getLooseSuperProperty(node, path.parent);

if (!t.isSuper(callee.object)) return;
t.appendToMemberExpression(callee, t.identifier("call"));

@@ -176,3 +173,2 @@ node.arguments.unshift(t.thisExpression());

var args = void 0;
var parent = path.parent;

@@ -187,2 +183,3 @@ var node = path.node;

var callee = node.callee;
if (t.isSuper(callee)) {

@@ -200,2 +197,3 @@ return;

var binary = t.assignmentExpression(node.operator[0] + "=", node.argument, t.numericLiteral(1));
if (node.prefix) {

@@ -212,3 +210,2 @@ return this.specHandleAssignmentExpression(null, path, binary);

if (!property) return;
var superProperty = this.getSuperProperty(property, computed);

@@ -225,3 +222,3 @@

var thisNode = t.thisExpression();
thisNode[HARDCORE_THIS_REF] = true;
HARDCORE_THIS_REF.add(thisNode);
return (0, _babelHelperOptimiseCallExpression2.default)(callee, thisNode, args);

@@ -228,0 +225,0 @@ };

{
"name": "babel-helper-replace-supers",
"version": "7.0.0-alpha.15",
"version": "7.0.0-alpha.16",
"description": "Helper function to replace supers",

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

"dependencies": {
"babel-helper-optimise-call-expression": "7.0.0-alpha.15",
"babel-messages": "7.0.0-alpha.15",
"babel-template": "7.0.0-alpha.15",
"babel-traverse": "7.0.0-alpha.15",
"babel-types": "7.0.0-alpha.15"
"babel-helper-optimise-call-expression": "7.0.0-alpha.16",
"babel-messages": "7.0.0-alpha.16",
"babel-template": "7.0.0-alpha.16",
"babel-traverse": "7.0.0-alpha.16",
"babel-types": "7.0.0-alpha.16"
}
}
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