Debian Codegraph @

packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-data-defined-on-parent/output.js

raw
1 "use strict";
2
3 let Base = /*#__PURE__*/function () {
4 function Base() {
5 babelHelpers.classCallCheck(this, Base);
6 }
7 babelHelpers.createClass(Base, [{
8 key: "test",
9 value: function test(...args) {
10 expect(this).toBe(obj);
11 expect(args).toEqual([1, 2, 3]);
12 return 1;
13 }
14 }]);
15 return Base;
16 }();
17 let Obj = /*#__PURE__*/function (_Base) {
18 babelHelpers.inherits(Obj, _Base);
19 var _super = babelHelpers.createSuper(Obj);
20 function Obj() {
21 babelHelpers.classCallCheck(this, Obj);
22 return _super.apply(this, arguments);
23 }
24 babelHelpers.createClass(Obj, [{
25 key: "call",
26 value: function call() {
27 babelHelpers.get(babelHelpers.getPrototypeOf(Obj.prototype), "test", this).call(this, 1, 2, 3);
28 babelHelpers.get(babelHelpers.getPrototypeOf(Obj.prototype), "test", this).call(this, 1, ...[2, 3]);
29 babelHelpers.get(babelHelpers.getPrototypeOf(Obj.prototype), "test", this).call(this, ...[1, 2, 3]);
30 return babelHelpers.get(babelHelpers.getPrototypeOf(Obj.prototype), "test", this).apply(this, arguments);
31 }
32 }, {
33 key: "test",
34 value: function test() {
35 throw new Error("called");
36 }
37 }]);
38 return Obj;
39 }(Base);
40 const obj = new Obj();
41 expect(obj.call(1, 2, 3)).toBe(1);