babel-helper-replace-supers
Advanced tools
Comparing version 7.0.0-alpha.15 to 7.0.0-alpha.16
@@ -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" | ||
} | ||
} |
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
177
8062
+ Addedansi-styles@3.2.1(transitive)
+ Addedbabel-code-frame@7.0.0-alpha.16(transitive)
+ Addedbabel-helper-function-name@7.0.0-alpha.16(transitive)
+ Addedbabel-helper-get-function-arity@7.0.0-alpha.16(transitive)
+ Addedbabel-helper-optimise-call-expression@7.0.0-alpha.16(transitive)
+ Addedbabel-messages@7.0.0-alpha.16(transitive)
+ Addedbabel-template@7.0.0-alpha.16(transitive)
+ Addedbabel-traverse@7.0.0-alpha.16(transitive)
+ Addedbabel-types@7.0.0-alpha.16(transitive)
+ Addedbabylon@7.0.0-beta.17(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedglobals@10.4.0(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedsupports-color@5.5.0(transitive)
+ Addedto-fast-properties@2.0.0(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedbabel-code-frame@7.0.0-alpha.15(transitive)
- Removedbabel-helper-function-name@7.0.0-alpha.15(transitive)
- Removedbabel-helper-get-function-arity@7.0.0-alpha.15(transitive)
- Removedbabel-helper-optimise-call-expression@7.0.0-alpha.15(transitive)
- Removedbabel-messages@7.0.0-alpha.15(transitive)
- Removedbabel-template@7.0.0-alpha.15(transitive)
- Removedbabel-traverse@7.0.0-alpha.15(transitive)
- Removedbabel-types@7.0.0-alpha.15(transitive)
- Removedbabylon@7.0.0-beta.13(transitive)
- Removedchalk@1.1.3(transitive)
- Removedglobals@9.18.0(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.0(transitive)
- Removedto-fast-properties@1.0.3(transitive)
Updatedbabel-types@7.0.0-alpha.16