babel-plugin-transform-es2015-classes
Advanced tools
Comparing version 7.0.0-alpha.19 to 7.0.0-alpha.20
@@ -18,4 +18,4 @@ "use strict"; | ||
var decorator = _ref; | ||
var expression = decorator.expression; | ||
var _decorator = _ref; | ||
var expression = _decorator.expression; | ||
if (!t.isMemberExpression(expression)) continue; | ||
@@ -36,5 +36,5 @@ var temp = scope.maybeGenerateMemoised(expression.object); | ||
if (nodes.length === 1) { | ||
decorator.expression = nodes[0]; | ||
_decorator.expression = nodes[0]; | ||
} else { | ||
decorator.expression = t.sequenceExpression(nodes); | ||
_decorator.expression = t.sequenceExpression(nodes); | ||
} | ||
@@ -41,0 +41,0 @@ } |
@@ -31,2 +31,3 @@ "use strict"; | ||
_this = _VanillaTransformer.apply(this, arguments) || this; | ||
_this._protoAlias = null; | ||
_this.isLoose = true; | ||
@@ -36,2 +37,11 @@ return _this; | ||
LooseClassTransformer.prototype._insertProtoAliasOnce = function _insertProtoAliasOnce() { | ||
if (!this._protoAlias) { | ||
this._protoAlias = this.scope.generateUidIdentifier("proto"); | ||
var classProto = t.memberExpression(this.classRef, t.identifier("prototype")); | ||
var protoDeclaration = t.variableDeclaration("var", [t.variableDeclarator(this._protoAlias, classProto)]); | ||
this.body.push(protoDeclaration); | ||
} | ||
}; | ||
LooseClassTransformer.prototype._processMethod = function _processMethod(node, scope) { | ||
@@ -42,3 +52,5 @@ if (!node.decorators) { | ||
if (!node.static) { | ||
classRef = t.memberExpression(classRef, t.identifier("prototype")); | ||
this._insertProtoAliasOnce(); | ||
classRef = this._protoAlias; | ||
} | ||
@@ -45,0 +57,0 @@ |
@@ -155,5 +155,7 @@ "use strict"; | ||
ClassTransformer.prototype.pushToMap = function pushToMap(node, enumerable) { | ||
var kind = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "value"; | ||
var scope = arguments[3]; | ||
ClassTransformer.prototype.pushToMap = function pushToMap(node, enumerable, kind, scope) { | ||
if (kind === void 0) { | ||
kind = "value"; | ||
} | ||
var mutatorMap = void 0; | ||
@@ -235,11 +237,11 @@ | ||
var path = _ref; | ||
var node = path.node; | ||
var _path = _ref; | ||
var node = _path.node; | ||
if (path.isClassProperty()) { | ||
throw path.buildCodeFrameError("Missing class properties transform."); | ||
if (_path.isClassProperty()) { | ||
throw _path.buildCodeFrameError("Missing class properties transform."); | ||
} | ||
if (node.decorators) { | ||
throw path.buildCodeFrameError("Method has decorators, put the decorator plugin before the classes one."); | ||
throw _path.buildCodeFrameError("Method has decorators, put the decorator plugin before the classes one."); | ||
} | ||
@@ -251,6 +253,6 @@ | ||
if (isConstructor) { | ||
path.traverse(verifyConstructorVisitor, this); | ||
_path.traverse(verifyConstructorVisitor, this); | ||
if (!this.hasBareSuper && this.isDerived) { | ||
throw path.buildCodeFrameError("missing super() call in constructor"); | ||
throw _path.buildCodeFrameError("missing super() call in constructor"); | ||
} | ||
@@ -261,3 +263,3 @@ } | ||
forceSuperMemoisation: isConstructor, | ||
methodPath: path, | ||
methodPath: _path, | ||
methodNode: node, | ||
@@ -274,5 +276,5 @@ objectRef: this.classRef, | ||
if (isConstructor) { | ||
this.pushConstructor(replaceSupers, node, path); | ||
this.pushConstructor(replaceSupers, node, _path); | ||
} else { | ||
this.pushMethod(node, path); | ||
this.pushMethod(node, _path); | ||
} | ||
@@ -415,7 +417,7 @@ } | ||
var bareSuper = _ref2; | ||
this.wrapSuperCall(bareSuper, superRef, thisRef, body); | ||
var _bareSuper = _ref2; | ||
this.wrapSuperCall(_bareSuper, superRef, thisRef, body); | ||
if (guaranteedSuperBeforeFinish) { | ||
bareSuper.find(function (parentPath) { | ||
_bareSuper.find(function (parentPath) { | ||
if (parentPath === path) { | ||
@@ -445,4 +447,5 @@ return true; | ||
var thisPath = _ref3; | ||
thisPath.replaceWith(thisRef); | ||
var _thisPath = _ref3; | ||
_thisPath.replaceWith(thisRef); | ||
} | ||
@@ -480,4 +483,5 @@ | ||
var returnPath = _ref4; | ||
returnPath.get("argument").replaceWith(wrapReturn(returnPath.node.argument)); | ||
var _returnPath = _ref4; | ||
_returnPath.get("argument").replaceWith(wrapReturn(_returnPath.node.argument)); | ||
} | ||
@@ -484,0 +488,0 @@ }; |
{ | ||
"name": "babel-plugin-transform-es2015-classes", | ||
"version": "7.0.0-alpha.19", | ||
"version": "7.0.0-alpha.20", | ||
"description": "Compile ES2015 classes to ES5", | ||
@@ -9,10 +9,10 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-classes", | ||
"dependencies": { | ||
"babel-helper-define-map": "7.0.0-alpha.19", | ||
"babel-helper-function-name": "7.0.0-alpha.19", | ||
"babel-helper-optimise-call-expression": "7.0.0-alpha.19", | ||
"babel-helper-replace-supers": "7.0.0-alpha.19", | ||
"babel-messages": "7.0.0-alpha.19", | ||
"babel-template": "7.0.0-alpha.19", | ||
"babel-traverse": "7.0.0-alpha.19", | ||
"babel-types": "7.0.0-alpha.19" | ||
"babel-helper-define-map": "7.0.0-alpha.20", | ||
"babel-helper-function-name": "7.0.0-alpha.20", | ||
"babel-helper-optimise-call-expression": "7.0.0-alpha.20", | ||
"babel-helper-replace-supers": "7.0.0-alpha.20", | ||
"babel-messages": "7.0.0-alpha.20", | ||
"babel-template": "7.0.0-alpha.20", | ||
"babel-traverse": "7.0.0-alpha.20", | ||
"babel-types": "7.0.0-alpha.20" | ||
}, | ||
@@ -23,4 +23,4 @@ "keywords": [ | ||
"devDependencies": { | ||
"babel-helper-plugin-test-runner": "7.0.0-alpha.19" | ||
"babel-helper-plugin-test-runner": "7.0.0-alpha.20" | ||
} | ||
} |
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
26547
559
+ Addedbabel-code-frame@7.0.0-alpha.20(transitive)
+ Addedbabel-helper-define-map@7.0.0-alpha.20(transitive)
+ Addedbabel-helper-function-name@7.0.0-alpha.20(transitive)
+ Addedbabel-helper-get-function-arity@7.0.0-alpha.20(transitive)
+ Addedbabel-helper-optimise-call-expression@7.0.0-alpha.20(transitive)
+ Addedbabel-helper-replace-supers@7.0.0-alpha.20(transitive)
+ Addedbabel-messages@7.0.0-alpha.20(transitive)
+ Addedbabel-template@7.0.0-alpha.20(transitive)
+ Addedbabel-traverse@7.0.0-alpha.20(transitive)
+ Addedbabel-types@7.0.0-alpha.20(transitive)
+ Addedbabylon@7.0.0-beta.22(transitive)
- Removedbabel-code-frame@7.0.0-alpha.19(transitive)
- Removedbabel-helper-define-map@7.0.0-alpha.19(transitive)
- Removedbabel-helper-function-name@7.0.0-alpha.19(transitive)
- Removedbabel-helper-get-function-arity@7.0.0-alpha.19(transitive)
- Removedbabel-helper-optimise-call-expression@7.0.0-alpha.19(transitive)
- Removedbabel-helper-replace-supers@7.0.0-alpha.19(transitive)
- Removedbabel-messages@7.0.0-alpha.19(transitive)
- Removedbabel-template@7.0.0-alpha.19(transitive)
- Removedbabel-traverse@7.0.0-alpha.19(transitive)
- Removedbabel-types@7.0.0-alpha.19(transitive)
- Removedbabylon@7.0.0-beta.18(transitive)
Updatedbabel-types@7.0.0-alpha.20