Add "use strict" directive (#7411)
* #7349 - Add "use strict" directive to transformed class bodies * Update tests (#7349) * Add test for program with use strict directive (#7349) * Update tests (#7349) * Update source mapping (#7349) * Add test for parent blockStatement with use strict directive (#7349) * Update tests (#7349) * Update tests (#7349) * Update tests (#7349) * Add test for constructor-only class (#7349) * Constructor only classes are strict, too But constructor only that use non-simple parameters must use a strict function wrapper. * Fix test * Wrapper not needed if class is already strict * Revert change to lerna.json
This commit is contained in:
parent
fdd0789936
commit
6597a472b3
@ -1,6 +1,8 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo(options) {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
"column": 10
|
||||
},
|
||||
"generated": {
|
||||
"line": 11,
|
||||
"line": 13,
|
||||
"column": 15
|
||||
}
|
||||
}]
|
||||
}]
|
||||
@ -24,6 +24,8 @@ var _ref4 = `template${expression}`;
|
||||
var MyClass =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function MyClass() {
|
||||
babelHelpers.classCallCheck(this, MyClass);
|
||||
this[null] = "null";
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var foo = "bar";
|
||||
|
||||
var Foo = function Foo() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
this.bar = foo;
|
||||
var _foo = "foo";
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo(...args) {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Child =
|
||||
/*#__PURE__*/
|
||||
function (_Parent) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Child, _Parent);
|
||||
|
||||
function Child() {
|
||||
|
||||
@ -2,6 +2,8 @@ function test(x) {
|
||||
var _x = x;
|
||||
|
||||
var F = function F() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, F);
|
||||
this[_x] = 1;
|
||||
};
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
var Foo = function Foo() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
this.bar = void 0;
|
||||
};
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
var Foo = function Foo() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
this.bar = "foo";
|
||||
};
|
||||
|
||||
@ -4,6 +4,8 @@ function withContext(ComposedComponent) {
|
||||
return _temp = _class =
|
||||
/*#__PURE__*/
|
||||
function (_Component) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(WithContext, _Component);
|
||||
|
||||
function WithContext() {
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
var _class, _temp;
|
||||
|
||||
var Foo = (_temp = _class = function Foo() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
}, _class.num = 0, _temp);
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
var Foo = function Foo() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
};
|
||||
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
var Foo = function Foo() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
};
|
||||
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var A =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function A() {
|
||||
babelHelpers.classCallCheck(this, A);
|
||||
}
|
||||
@ -17,6 +19,8 @@ function () {
|
||||
var B =
|
||||
/*#__PURE__*/
|
||||
function (_A) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(B, _A);
|
||||
|
||||
function B(...args) {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
var A = function A(_force) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, A);
|
||||
this.force = force;
|
||||
this.foo = babelHelpers.get(babelHelpers.getPrototypeOf(A.prototype), "method", babelHelpers.assertThisInitialized(this)).call(this);
|
||||
|
||||
@ -24,6 +24,8 @@ var _ref4 = `template${expression}`;
|
||||
var MyClass =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function MyClass() {
|
||||
babelHelpers.classCallCheck(this, MyClass);
|
||||
Object.defineProperty(this, null, {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var foo = "bar";
|
||||
|
||||
var Foo = function Foo() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
Object.defineProperty(this, "bar", {
|
||||
configurable: true,
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo(...args) {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Child =
|
||||
/*#__PURE__*/
|
||||
function (_Parent) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Child, _Parent);
|
||||
|
||||
function Child() {
|
||||
|
||||
@ -2,6 +2,8 @@ function test(x) {
|
||||
var _x = x;
|
||||
|
||||
var F = function F() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, F);
|
||||
Object.defineProperty(this, _x, {
|
||||
configurable: true,
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
var Foo = function Foo() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
Object.defineProperty(this, "bar", {
|
||||
configurable: true,
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
var Foo = function Foo() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
Object.defineProperty(this, "bar", {
|
||||
configurable: true,
|
||||
|
||||
@ -4,6 +4,8 @@ function withContext(ComposedComponent) {
|
||||
return _temp = _class =
|
||||
/*#__PURE__*/
|
||||
function (_Component) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(WithContext, _Component);
|
||||
|
||||
function WithContext() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var _class, _temp;
|
||||
|
||||
var Foo = (_temp = _class = function Foo() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
}, Object.defineProperty(_class, "num", {
|
||||
configurable: true,
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
var Foo = function Foo() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
};
|
||||
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
var Foo = function Foo() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
};
|
||||
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var A =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function A() {
|
||||
babelHelpers.classCallCheck(this, A);
|
||||
}
|
||||
@ -17,6 +19,8 @@ function () {
|
||||
var B =
|
||||
/*#__PURE__*/
|
||||
function (_A) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(B, _A);
|
||||
|
||||
function B(...args) {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
var A = function A(_force) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, A);
|
||||
Object.defineProperty(this, "force", {
|
||||
configurable: true,
|
||||
|
||||
@ -17,6 +17,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || functio
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
var Test = function Test() {
|
||||
"use strict";
|
||||
|
||||
var _this2 = this;
|
||||
|
||||
_classCallCheck(this, Test);
|
||||
|
||||
@ -4,6 +4,8 @@ function withContext(ComposedComponent) {
|
||||
return _temp = _class =
|
||||
/*#__PURE__*/
|
||||
function (_Component) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(WithContext, _Component);
|
||||
|
||||
function WithContext() {
|
||||
|
||||
@ -30,6 +30,8 @@ function generateAsyncAction(type) {
|
||||
var A =
|
||||
/*#__PURE__*/
|
||||
function (_B) {
|
||||
"use strict";
|
||||
|
||||
_inherits(A, _B);
|
||||
|
||||
function A(timestamp) {
|
||||
|
||||
@ -11,6 +11,8 @@ function _two() {}
|
||||
let Test1 =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function Test1() {
|
||||
_classCallCheck(this, Test1);
|
||||
}
|
||||
|
||||
@ -688,16 +688,51 @@ export default function transformClass(
|
||||
classState.staticPropBody.map(fn => fn(t.cloneNode(classState.classRef))),
|
||||
);
|
||||
|
||||
if (classState.classId && body.length === 1) {
|
||||
const strictParent = path.findParent(path => {
|
||||
if (path.isProgram() && path.node.sourceType === "module") {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (path.isClassBody()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!path.isProgram() && !path.isBlockStatement()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return path.node.directives.some(
|
||||
directive => directive.value.value === "use strict",
|
||||
);
|
||||
});
|
||||
|
||||
let constructorOnly = classState.classId && body.length === 1;
|
||||
if (constructorOnly && !strictParent) {
|
||||
for (const param of classState.construct.params) {
|
||||
// It's illegal to put a use strict directive into the body of a function
|
||||
// with non-simple parameters for some reason. So, we have to use a strict
|
||||
// wrapper function.
|
||||
if (!t.isIdentifier(param)) {
|
||||
constructorOnly = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const directives = constructorOnly ? body[0].body.directives : [];
|
||||
if (!strictParent) {
|
||||
directives.push(t.directive(t.directiveLiteral("use strict")));
|
||||
}
|
||||
|
||||
if (constructorOnly) {
|
||||
// named class with only a constructor
|
||||
return t.toExpression(body[0]);
|
||||
}
|
||||
|
||||
body.push(t.returnStatement(t.cloneNode(classState.classRef)));
|
||||
|
||||
const container = t.arrowFunctionExpression(
|
||||
closureParams,
|
||||
t.blockStatement(body),
|
||||
t.blockStatement(body, directives),
|
||||
);
|
||||
return t.callExpression(container, closureArgs);
|
||||
}
|
||||
|
||||
@ -11,6 +11,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || functio
|
||||
var List =
|
||||
/*#__PURE__*/
|
||||
function (_Array) {
|
||||
"use strict";
|
||||
|
||||
_inheritsLoose(List, _Array);
|
||||
|
||||
function List() {
|
||||
|
||||
@ -1,10 +1,14 @@
|
||||
let Array = function Array() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Array);
|
||||
};
|
||||
|
||||
let List =
|
||||
/*#__PURE__*/
|
||||
function (_Array) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(List, _Array);
|
||||
|
||||
function List() {
|
||||
|
||||
@ -17,6 +17,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || functio
|
||||
var List =
|
||||
/*#__PURE__*/
|
||||
function (_Array) {
|
||||
"use strict";
|
||||
|
||||
_inherits(List, _Array);
|
||||
|
||||
function List() {
|
||||
|
||||
@ -1 +1,3 @@
|
||||
let A = function A() {};
|
||||
let A = function A() {
|
||||
"use strict";
|
||||
};
|
||||
|
||||
@ -1,10 +1,14 @@
|
||||
let A = function A() {
|
||||
"use strict";
|
||||
|
||||
console.log('a');
|
||||
};
|
||||
|
||||
let B =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function B() {}
|
||||
|
||||
var _proto = B.prototype;
|
||||
|
||||
@ -2,11 +2,15 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
|
||||
let B = function B() {};
|
||||
let B = function B() {
|
||||
"use strict";
|
||||
};
|
||||
|
||||
let A =
|
||||
/*#__PURE__*/
|
||||
function (_B) {
|
||||
"use strict";
|
||||
|
||||
_inheritsLoose(A, _B);
|
||||
|
||||
function A(track) {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function (_Foo) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inheritsLoose(Test, _Foo);
|
||||
|
||||
function Test() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function (_Foo) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inheritsLoose(Test, _Foo);
|
||||
|
||||
function Test() {
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
function t() {
|
||||
"use strict";
|
||||
class Foo {
|
||||
method() {}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
function t() {
|
||||
"use strict";
|
||||
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function Foo() {}
|
||||
|
||||
var _proto = Foo.prototype;
|
||||
|
||||
_proto.method = function method() {};
|
||||
|
||||
return Foo;
|
||||
}();
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function (_Foo) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inheritsLoose(Test, _Foo);
|
||||
|
||||
function Test() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var x =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
var _proto = x.prototype;
|
||||
|
||||
_proto.f = function f() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inheritsLoose(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Child =
|
||||
/*#__PURE__*/
|
||||
function (_Base) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inheritsLoose(Child, _Base);
|
||||
|
||||
function Child() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Child =
|
||||
/*#__PURE__*/
|
||||
function (_Base) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inheritsLoose(Child, _Base);
|
||||
|
||||
function Child() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function Foo() {}
|
||||
|
||||
var _proto = Foo.prototype;
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
var C =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function C() {}
|
||||
|
||||
var _proto = C.prototype;
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function Test() {}
|
||||
|
||||
var _proto = Test.prototype;
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
class Foo {
|
||||
method() {
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function Foo() {}
|
||||
|
||||
var _proto = Foo.prototype;
|
||||
|
||||
_proto.method = function method() {};
|
||||
|
||||
return Foo;
|
||||
}();
|
||||
@ -1,6 +1,8 @@
|
||||
var BaseController =
|
||||
/*#__PURE__*/
|
||||
function (_Chaplin$Controller) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inheritsLoose(BaseController, _Chaplin$Controller);
|
||||
|
||||
function BaseController() {
|
||||
@ -13,6 +15,8 @@ function (_Chaplin$Controller) {
|
||||
var BaseController2 =
|
||||
/*#__PURE__*/
|
||||
function (_Chaplin$Controller$A) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inheritsLoose(BaseController2, _Chaplin$Controller$A);
|
||||
|
||||
function BaseController2() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function (_Foo) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inheritsLoose(Test, _Foo);
|
||||
|
||||
function Test() {
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
var Test = function Test() {
|
||||
"use strict";
|
||||
|
||||
Function.prototype.hasOwnProperty.call(this, "test");
|
||||
};
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var A =
|
||||
/*#__PURE__*/
|
||||
function (_B) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(A, _B);
|
||||
|
||||
function A() {
|
||||
|
||||
@ -2,6 +2,8 @@ var x = {
|
||||
Foo:
|
||||
/*#__PURE__*/
|
||||
function (_Foo) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(_class, _Foo);
|
||||
|
||||
function _class() {
|
||||
|
||||
@ -1,10 +1,14 @@
|
||||
var A = function A() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, A);
|
||||
};
|
||||
|
||||
var B =
|
||||
/*#__PURE__*/
|
||||
function (_A) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(B, _A);
|
||||
|
||||
function B() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var A =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function A() {
|
||||
babelHelpers.classCallCheck(this, A);
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Example =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function Example() {}
|
||||
|
||||
var _proto = Example.prototype;
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function Foo(val) {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
this._val = val;
|
||||
|
||||
@ -15,12 +15,16 @@ function _instanceof(left, right) { if (right != null && typeof Symbol !== "unde
|
||||
function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var B = function B() {
|
||||
"use strict";
|
||||
|
||||
_classCallCheck(this, B);
|
||||
};
|
||||
|
||||
var A =
|
||||
/*#__PURE__*/
|
||||
function (_B) {
|
||||
"use strict";
|
||||
|
||||
_inherits(A, _B);
|
||||
|
||||
function A(track) {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function (_Foo) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Test, _Foo);
|
||||
|
||||
function Test() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function (_Foo) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Test, _Foo);
|
||||
|
||||
function Test() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function (_Foo) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Test, _Foo);
|
||||
|
||||
function Test() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
var Example = function Example() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Example);
|
||||
|
||||
var _Example;
|
||||
|
||||
5
packages/babel-plugin-transform-classes/test/fixtures/spec/constructor-only/input.js
vendored
Normal file
5
packages/babel-plugin-transform-classes/test/fixtures/spec/constructor-only/input.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
5
packages/babel-plugin-transform-classes/test/fixtures/spec/constructor-only/output.js
vendored
Normal file
5
packages/babel-plugin-transform-classes/test/fixtures/spec/constructor-only/output.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
var Foo = function Foo() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
};
|
||||
@ -1,4 +1,6 @@
|
||||
var Test = function Test() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
this.state = "test";
|
||||
};
|
||||
@ -6,6 +8,8 @@ var Test = function Test() {
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
@ -21,6 +25,8 @@ function (_Bar) {
|
||||
}(Bar);
|
||||
|
||||
var ConstructorScoping = function ConstructorScoping() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, ConstructorScoping);
|
||||
var bar;
|
||||
{
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Child =
|
||||
/*#__PURE__*/
|
||||
function (_Base) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Child, _Base);
|
||||
|
||||
function Child() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Child =
|
||||
/*#__PURE__*/
|
||||
function (_Base) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Child, _Base);
|
||||
|
||||
function Child() {
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
var o = {
|
||||
foo: function foo() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, foo);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
}
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
var C =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function C() {
|
||||
babelHelpers.classCallCheck(this, C);
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
var Test = function Test() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
};
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
var MyCtrl = function MyCtrl(a) {
|
||||
"any directive prologue";
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, MyCtrl);
|
||||
foo;
|
||||
@ -8,6 +9,7 @@ var MyCtrl = function MyCtrl(a) {
|
||||
var MyCtrl2 = function MyCtrl2(a) {
|
||||
"a";
|
||||
"b";
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, MyCtrl2);
|
||||
foo;
|
||||
@ -15,6 +17,7 @@ var MyCtrl2 = function MyCtrl2(a) {
|
||||
|
||||
var MyCtrl3 = function MyCtrl3(a) {
|
||||
"a";
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, MyCtrl3);
|
||||
foo;
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
var BaseView = function BaseView() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, BaseView);
|
||||
this.autoRender = true;
|
||||
};
|
||||
|
||||
var BaseView = function BaseView() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, BaseView);
|
||||
this.autoRender = true;
|
||||
};
|
||||
@ -11,6 +15,8 @@ var BaseView = function BaseView() {
|
||||
var BaseView =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function BaseView() {
|
||||
babelHelpers.classCallCheck(this, BaseView);
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var A =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function A() {
|
||||
babelHelpers.classCallCheck(this, A);
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var TestEmpty =
|
||||
/*#__PURE__*/
|
||||
function (_ref) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(TestEmpty, _ref);
|
||||
|
||||
function TestEmpty() {
|
||||
@ -12,6 +14,8 @@ function (_ref) {
|
||||
}(
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function _class() {
|
||||
babelHelpers.classCallCheck(this, _class);
|
||||
}
|
||||
@ -22,6 +26,8 @@ function () {
|
||||
var TestConstructorOnly =
|
||||
/*#__PURE__*/
|
||||
function (_ref2) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(TestConstructorOnly, _ref2);
|
||||
|
||||
function TestConstructorOnly() {
|
||||
@ -33,6 +39,8 @@ function (_ref2) {
|
||||
}(
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function _class2() {
|
||||
babelHelpers.classCallCheck(this, _class2);
|
||||
}
|
||||
@ -43,6 +51,8 @@ function () {
|
||||
var TestMethodOnly =
|
||||
/*#__PURE__*/
|
||||
function (_ref3) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(TestMethodOnly, _ref3);
|
||||
|
||||
function TestMethodOnly() {
|
||||
@ -54,6 +64,8 @@ function (_ref3) {
|
||||
}(
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function _class3() {
|
||||
babelHelpers.classCallCheck(this, _class3);
|
||||
}
|
||||
@ -68,6 +80,8 @@ function () {
|
||||
var TestConstructorAndMethod =
|
||||
/*#__PURE__*/
|
||||
function (_ref4) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(TestConstructorAndMethod, _ref4);
|
||||
|
||||
function TestConstructorAndMethod() {
|
||||
@ -79,6 +93,8 @@ function (_ref4) {
|
||||
}(
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function _class4() {
|
||||
babelHelpers.classCallCheck(this, _class4);
|
||||
}
|
||||
@ -93,6 +109,8 @@ function () {
|
||||
var TestMultipleMethods =
|
||||
/*#__PURE__*/
|
||||
function (_ref5) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(TestMultipleMethods, _ref5);
|
||||
|
||||
function TestMultipleMethods() {
|
||||
@ -104,6 +122,8 @@ function (_ref5) {
|
||||
}(
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function _class5() {
|
||||
babelHelpers.classCallCheck(this, _class5);
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var BaseController =
|
||||
/*#__PURE__*/
|
||||
function (_Chaplin$Controller) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(BaseController, _Chaplin$Controller);
|
||||
|
||||
function BaseController() {
|
||||
@ -14,6 +16,8 @@ function (_Chaplin$Controller) {
|
||||
var BaseController2 =
|
||||
/*#__PURE__*/
|
||||
function (_Chaplin$Controller$A) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(BaseController2, _Chaplin$Controller$A);
|
||||
|
||||
function BaseController2() {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function (_Foo) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Test, _Foo);
|
||||
|
||||
function Test() {
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
var Test = function Test() {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
babelHelpers.get(babelHelpers.getPrototypeOf(Test.prototype), "hasOwnProperty", babelHelpers.assertThisInitialized(this)).call(this, "test");
|
||||
};
|
||||
|
||||
@ -15,6 +15,8 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
_inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
|
||||
@ -15,6 +15,8 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
_inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user