as per "ES6 February 2, 2015 Draft Rev 32" "Constructors defined using class definition syntax throw when called as functions"

This commit is contained in:
Sebastian McKenzie 2015-02-03 15:16:16 +11:00
parent 92d9b3ff5f
commit 3a11c7d46b
41 changed files with 251 additions and 62 deletions

View File

@ -51,7 +51,9 @@ File.helpers = [
"typeof",
"extends",
"get",
"set"
"set",
"class-call-check",
"class-super-constructor-call"
];
File.validOptions = [

View File

@ -0,0 +1,5 @@
(function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
});

View File

@ -1,3 +1,5 @@
if (Object.getPrototypeOf(CLASS_NAME) !== null) {
Object.getPrototypeOf(CLASS_NAME).apply(this, arguments);
}
(function (Constructor) {
if (Object.getPrototypeOf(Constructor) !== null) {
Object.getPrototypeOf(Constructor).apply(this, arguments);
}
});

View File

@ -67,12 +67,19 @@ Class.prototype.run = function () {
var body = this.body = [];
var constructorBody = t.blockStatement([
t.expressionStatement(t.callExpression(file.addHelper("class-call-check"), [
t.thisExpression(),
className
]))
]);
var constructor;
if (this.node.id) {
constructor = t.functionDeclaration(className, [], t.blockStatement([]));
constructor = t.functionDeclaration(className, [], constructorBody);
body.push(constructor);
} else {
constructor = t.functionExpression(null, [], t.blockStatement([]));
constructor = t.functionExpression(null, [], constructorBody);
body.push(t.variableDeclaration("var", [
t.variableDeclarator(className, constructor)
]));
@ -161,13 +168,18 @@ Class.prototype.buildBody = function () {
// we have no constructor, we have a super, and the super doesn't appear to be falsy
if (!this.hasConstructor && superName && !t.isFalsyExpression(superName)) {
var defaultConstructorTemplate = "class-super-constructor-call";
if (this.isLoose) defaultConstructorTemplate += "-loose";
var helperName = "class-super-constructor-call";
constructor.body.body.push(util.template(defaultConstructorTemplate, {
CLASS_NAME: className,
SUPER_NAME: this.superName
}, true));
if (this.isLoose) {
constructor.body.body.push(util.template(helperName + "-loose", {
CLASS_NAME: className,
SUPER_NAME: this.superName
}, true));
} else {
constructor.body.body.push(
t.expressionStatement(t.callExpression(this.file.addHelper(helperName), [className]))
);
}
}
var instanceProps;
@ -256,5 +268,5 @@ Class.prototype.pushConstructor = function (method) {
construct._ignoreUserWhitespace = true;
construct.params = fn.params;
construct.body = fn.body;
construct.body.body = construct.body.body.concat(fn.body.body);
};

View File

@ -1,5 +1,9 @@
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = function Test() {
_classCallCheck(this, Test);
arr.map(x => x * x);
};
};

View File

@ -4,8 +4,12 @@ var _asyncToGenerator = function (fn) { return function () { var gen = fn.apply(
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Foo = (function () {
function Foo() {}
function Foo() {
_classCallCheck(this, Foo);
}
_prototypeProperties(Foo, null, {
foo: {

View File

@ -4,8 +4,12 @@ var _bluebird = require("bluebird");
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Foo = (function () {
function Foo() {}
function Foo() {
_classCallCheck(this, Foo);
}
_prototypeProperties(Foo, null, {
foo: {

View File

@ -3,9 +3,13 @@
var _slice = Array.prototype.slice;
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function (Foo) {
function Test() {
var _Foo$prototype$test, _Foo$prototype$test2;
_classCallCheck(this, Test);
woops["super"].test();
Foo.call(this);
Foo.prototype.test.call(this);

View File

@ -2,8 +2,12 @@
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function (Foo) {
function Test() {
_classCallCheck(this, Test);
Foo.prototype.test;
Foo.prototype.test.whatever;
}

View File

@ -2,8 +2,12 @@
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function (Foo) {
function Test() {
_classCallCheck(this, Test);
Foo.prototype.test.whatever();
Foo.prototype.test.call(this);
}

View File

@ -2,8 +2,12 @@
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var BaseController = (function (_Chaplin$Controller) {
function BaseController() {
_classCallCheck(this, BaseController);
if (_Chaplin$Controller != null) {
_Chaplin$Controller.apply(this, arguments);
}
@ -16,6 +20,8 @@ var BaseController = (function (_Chaplin$Controller) {
var BaseController2 = (function (_Chaplin$Controller$Another) {
function BaseController2() {
_classCallCheck(this, BaseController2);
if (_Chaplin$Controller$Another != null) {
_Chaplin$Controller$Another.apply(this, arguments);
}

View File

@ -2,8 +2,12 @@
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function (Foo) {
function Test() {
_classCallCheck(this, Test);
if (Foo != null) {
Foo.apply(this, arguments);
}

View File

@ -1,5 +1,9 @@
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = function Test() {
_classCallCheck(this, Test);
Function.prototype.hasOwnProperty.call(this, "test");
};
};

View File

@ -7,9 +7,13 @@ var _get = function get(object, property, receiver) { var desc = Object.getOwnPr
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function (Foo) {
function Test() {
var _get2, _get3;
_classCallCheck(this, Test);
woops["super"].test();
_get(Object.getPrototypeOf(Test.prototype), "constructor", this).call(this);
_get(Object.getPrototypeOf(Test.prototype), "test", this).call(this);

View File

@ -4,8 +4,12 @@ var _get = function get(object, property, receiver) { var desc = Object.getOwnPr
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function (Foo) {
function Test() {
_classCallCheck(this, Test);
_get(Object.getPrototypeOf(Test.prototype), "test", this);
_get(Object.getPrototypeOf(Test.prototype), "test", this).whatever;
}

View File

@ -6,8 +6,12 @@ var _get = function get(object, property, receiver) { var desc = Object.getOwnPr
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function (Foo) {
function Test() {
_classCallCheck(this, Test);
_get(Object.getPrototypeOf(Test.prototype), "test", this).whatever();
_get(Object.getPrototypeOf(Test.prototype), "test", this).call(this);
}

View File

@ -2,12 +2,18 @@
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = function Test() {
_classCallCheck(this, Test);
this.state = "test";
};
var Foo = (function (Bar) {
function Foo() {
_classCallCheck(this, Foo);
this.state = "test";
}

View File

@ -2,8 +2,12 @@
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function () {
function Test() {}
function Test() {
_classCallCheck(this, Test);
}
_prototypeProperties(Test, null, {
test: {

View File

@ -2,8 +2,12 @@
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function () {
function Test() {}
function Test() {
_classCallCheck(this, Test);
}
_prototypeProperties(Test, null, {
test: {

View File

@ -2,8 +2,12 @@
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function () {
function Test() {}
function Test() {
_classCallCheck(this, Test);
}
_prototypeProperties(Test, null, {
test: {

View File

@ -2,8 +2,12 @@
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function () {
function Test() {}
function Test() {
_classCallCheck(this, Test);
}
_prototypeProperties(Test, null, {
test: {

View File

@ -1,3 +1,7 @@
"use strict";
var Test = function Test() {};
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = function Test() {
_classCallCheck(this, Test);
};

View File

@ -2,16 +2,24 @@
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var BaseView = function BaseView() {
_classCallCheck(this, BaseView);
this.autoRender = true;
};
var BaseView = function BaseView() {
_classCallCheck(this, BaseView);
this.autoRender = true;
};
var BaseView = (function () {
function BaseView() {}
function BaseView() {
_classCallCheck(this, BaseView);
}
_prototypeProperties(BaseView, null, {
foo: {

View File

@ -2,8 +2,12 @@
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var A = (function () {
function A() {}
function A() {
_classCallCheck(this, A);
}
_prototypeProperties(A, {
a: {

View File

@ -1,12 +1,16 @@
"use strict";
var _classSuperConstructorCall = function (Constructor) { if (Object.getPrototypeOf(Constructor) !== null) { Object.getPrototypeOf(Constructor).apply(this, arguments); } };
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var BaseController = (function (_Chaplin$Controller) {
function BaseController() {
if (Object.getPrototypeOf(BaseController) !== null) {
Object.getPrototypeOf(BaseController).apply(this, arguments);
}
_classCallCheck(this, BaseController);
_classSuperConstructorCall(BaseController);
}
_inherits(BaseController, _Chaplin$Controller);
@ -16,9 +20,9 @@ var BaseController = (function (_Chaplin$Controller) {
var BaseController2 = (function (_Chaplin$Controller$Another) {
function BaseController2() {
if (Object.getPrototypeOf(BaseController2) !== null) {
Object.getPrototypeOf(BaseController2).apply(this, arguments);
}
_classCallCheck(this, BaseController2);
_classSuperConstructorCall(BaseController2);
}
_inherits(BaseController2, _Chaplin$Controller$Another);

View File

@ -1,12 +1,16 @@
"use strict";
var _classSuperConstructorCall = function (Constructor) { if (Object.getPrototypeOf(Constructor) !== null) { Object.getPrototypeOf(Constructor).apply(this, arguments); } };
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function (Foo) {
function Test() {
if (Object.getPrototypeOf(Test) !== null) {
Object.getPrototypeOf(Test).apply(this, arguments);
}
_classCallCheck(this, Test);
_classSuperConstructorCall(Test);
}
_inherits(Test, Foo);

View File

@ -2,6 +2,10 @@
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = function Test() {
_classCallCheck(this, Test);
_get(Object.getPrototypeOf(Test.prototype), "hasOwnProperty", this).call(this, "test");
};

View File

@ -1,6 +1,8 @@
define(["exports", "module"], function (exports, module) {
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
module.exports = foo;
module.exports = 42;
module.exports = {};
@ -8,11 +10,15 @@ define(["exports", "module"], function (exports, module) {
module.exports = foo;
module.exports = function () {};
var _default = function _default() {};
var _default = function _default() {
_classCallCheck(this, _default);
};
module.exports = _default;
function foo() {}
var Foo = function Foo() {};
var Foo = function Foo() {
_classCallCheck(this, Foo);
};
module.exports = Foo;
});

View File

@ -1,6 +1,8 @@
define(["exports"], function (exports) {
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
exports.foo7 = foo7;
var foo = exports.foo = 1;
var foo = exports.foo = 1;
@ -11,7 +13,9 @@ define(["exports"], function (exports) {
var foo5 = exports.foo5 = undefined;
var foo6 = exports.foo6 = 3;
function foo7() {}
var foo8 = exports.foo8 = function foo8() {};
var foo8 = exports.foo8 = function foo8() {
_classCallCheck(this, foo8);
};
exports.__esModule = true;
});
});

View File

@ -1,5 +1,7 @@
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
module.exports = foo;
module.exports = 42;
module.exports = {};
@ -7,10 +9,14 @@ module.exports = [];
module.exports = foo;
module.exports = function () {};
var _default = function _default() {};
var _default = function _default() {
_classCallCheck(this, _default);
};
module.exports = _default;
function foo() {}
var Foo = function Foo() {};
var Foo = function Foo() {
_classCallCheck(this, Foo);
};
module.exports = Foo;

View File

@ -1,5 +1,7 @@
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
exports.foo7 = foo7;
var foo = exports.foo = 1;
var foo = exports.foo = 1;
@ -10,6 +12,8 @@ var foo4 = exports.foo4 = 2;
var foo5 = exports.foo5 = undefined;
var foo6 = exports.foo6 = 3;
function foo7() {}
var foo8 = exports.foo8 = function foo8() {};
var foo8 = exports.foo8 = function foo8() {
_classCallCheck(this, foo8);
};
exports.__esModule = true;
exports.__esModule = true;

View File

@ -1,6 +1,12 @@
"use strict";
var _default = function _default() {};
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var _default = function _default() {
_classCallCheck(this, _default);
};
function foo() {}
var Foo = function Foo() {};
var Foo = function Foo() {
_classCallCheck(this, Foo);
};

View File

@ -1,5 +1,7 @@
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var foo = 1;
var foo = 1,
bar = 2;
@ -9,4 +11,6 @@ var foo4 = 2;
var foo5 = undefined;
var foo6 = 3;
function foo7() {}
var foo8 = function foo8() {};
var foo8 = function foo8() {
_classCallCheck(this, foo8);
};

View File

@ -1,13 +1,15 @@
System.register([], function (_export) {
"use strict";
var _default, Foo;
var _classCallCheck, _default, Foo;
_export("default", foo);
function foo() {}
return {
setters: [],
execute: function () {
_classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
_export("default", 42);
_export("default", {});
@ -18,11 +20,15 @@ System.register([], function (_export) {
_export("default", function () {});
_default = function _default() {};
_default = function _default() {
_classCallCheck(this, _default);
};
_export("default", _default);
Foo = function Foo() {};
Foo = function Foo() {
_classCallCheck(this, Foo);
};
_export("default", Foo);
}

View File

@ -1,21 +1,25 @@
System.register([], function (_export) {
"use strict";
var foo, foo2, foo3, foo4, foo5, foo6, foo8;
var _classCallCheck, foo, foo2, foo3, foo4, foo5, foo6, foo8;
_export("foo7", foo7);
function foo7() {}
return {
setters: [],
execute: function () {
_classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
foo = _export("foo", 1);
foo2 = _export("foo2", function () {});
foo3 = _export("foo3", undefined);
foo4 = _export("foo4", 2);
foo5 = _export("foo5", undefined);
foo6 = _export("foo6", 3);
foo8 = _export("foo8", function foo8() {});
foo8 = _export("foo8", function foo8() {
_classCallCheck(this, foo8);
});
_export("foo3", foo3 = 5);
}
};
});
});

View File

@ -7,6 +7,8 @@
})(function (exports, module) {
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
module.exports = foo;
module.exports = 42;
module.exports = {};
@ -14,11 +16,15 @@
module.exports = foo;
module.exports = function () {};
var _default = function _default() {};
var _default = function _default() {
_classCallCheck(this, _default);
};
module.exports = _default;
function foo() {}
var Foo = function Foo() {};
var Foo = function Foo() {
_classCallCheck(this, Foo);
};
module.exports = Foo;
});

View File

@ -7,6 +7,8 @@
})(function (exports) {
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
exports.foo7 = foo7;
var foo = exports.foo = 1;
var foo = exports.foo = 1;
@ -17,7 +19,9 @@
var foo5 = exports.foo5 = undefined;
var foo6 = exports.foo6 = 3;
function foo7() {}
var foo8 = exports.foo8 = function foo8() {};
var foo8 = exports.foo8 = function foo8() {
_classCallCheck(this, foo8);
};
exports.__esModule = true;
});
});

View File

@ -1,5 +1,7 @@
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var A = new WeakMap();
var B = new WeakMap(),
C = new WeakMap();
@ -7,7 +9,9 @@ var D = (function () {
var F = new WeakMap(),
G = new WeakMap();
var E = new WeakMap();
function D() {}
function D() {
_classCallCheck(this, D);
}
return D;
})();
@ -16,7 +20,9 @@ var H = (function () {
var J = new WeakMap(),
K = new WeakMap();
var I = new WeakMap();
function H() {}
function H() {
_classCallCheck(this, H);
}
return H;
})();
})();

View File

@ -2,10 +2,14 @@
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var _defineProperty = function (obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); };
var Foo = (function () {
function Foo() {}
function Foo() {
_classCallCheck(this, Foo);
}
_prototypeProperties(Foo, null, _defineProperty({
bar: {

View File

@ -2,8 +2,12 @@
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function () {
function Test() {}
function Test() {
_classCallCheck(this, Test);
}
_prototypeProperties(Test, null, {
bar: {

View File

@ -2,13 +2,17 @@
var _defaults = function (obj, defaults) { for (var key in defaults) { if (obj[key] === undefined) { obj[key] = defaults[key]; } } return obj; };
var _classSuperConstructorCall = function (Constructor) { if (Object.getPrototypeOf(Constructor) !== null) { Object.getPrototypeOf(Constructor).apply(this, arguments); } };
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) _defaults(subClass, superClass); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Foo = (function (Bar) {
function Foo() {
if (Object.getPrototypeOf(Foo) !== null) {
Object.getPrototypeOf(Foo).apply(this, arguments);
}
_classCallCheck(this, Foo);
_classSuperConstructorCall(Foo);
}
_inherits(Foo, Bar);