mirror of
https://github.com/swc-project/swc.git
synced 2025-01-07 06:06:41 +03:00
76 lines
3.2 KiB
JavaScript
76 lines
3.2 KiB
JavaScript
function _classCallCheck(instance, Constructor) {
|
|
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
}
|
|
function _defineProperties(target, props) {
|
|
for(var i = 0; i < props.length; i++){
|
|
var descriptor = props[i];
|
|
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
|
|
}
|
|
}
|
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
return protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Constructor;
|
|
}
|
|
function _get(target, property, receiver) {
|
|
return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function _get(target, property, receiver) {
|
|
var base = _superPropBase(target, property);
|
|
if (base) {
|
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
return desc.get ? desc.get.call(receiver) : desc.value;
|
|
}
|
|
}, _get(target, property, receiver || target);
|
|
}
|
|
function _getPrototypeOf(o) {
|
|
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
}, _getPrototypeOf(o);
|
|
}
|
|
function _setPrototypeOf(o, p) {
|
|
return _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
return o.__proto__ = p, o;
|
|
}, _setPrototypeOf(o, p);
|
|
}
|
|
function _superPropBase(object, property) {
|
|
for(; !Object.prototype.hasOwnProperty.call(object, property) && null !== (object = _getPrototypeOf(object)););
|
|
return object;
|
|
}
|
|
var Base = function() {
|
|
"use strict";
|
|
function Base() {
|
|
_classCallCheck(this, Base);
|
|
}
|
|
return _createClass(Base, [
|
|
{
|
|
key: "method",
|
|
value: function() {
|
|
this.x;
|
|
}
|
|
}
|
|
]), Base;
|
|
}(), Derived = function(Base) {
|
|
"use strict";
|
|
function Derived() {
|
|
var self, call, obj;
|
|
return _classCallCheck(this, Derived), self = this, call = _getPrototypeOf(Derived).apply(this, arguments), call && ("object" == ((obj = call) && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj) || "function" == typeof call) ? call : (function(self) {
|
|
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
return self;
|
|
})(self);
|
|
}
|
|
return !function(subClass, superClass) {
|
|
if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function");
|
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
constructor: {
|
|
value: subClass,
|
|
writable: !0,
|
|
configurable: !0
|
|
}
|
|
}), superClass && _setPrototypeOf(subClass, superClass);
|
|
}(Derived, Base), _createClass(Derived, [
|
|
{
|
|
key: "method1",
|
|
value: function() {
|
|
this.x, _get(_getPrototypeOf(Derived.prototype), "x", this);
|
|
}
|
|
}
|
|
]), Derived;
|
|
}(Base);
|