Debian Codegraph @

packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-getter-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 get: function () {
10 expect(this).toBe(obj);
11 return function (...args) {
12 expect(this).toBe(obj);
13 expect(args).toEqual([1, 2, 3]);
14 return 1;
15 };
16 }
17 }]);
18 return Base;
19 }();
20 let Obj = /*#__PURE__*/function (_Base) {
21 babelHelpers.inherits(Obj, _Base);
22 var _super = babelHelpers.createSuper(Obj);
23 function Obj() {
24 babelHelpers.classCallCheck(this, Obj);
25 return _super.apply(this, arguments);
26 }
27 babelHelpers.createClass(Obj, [{
28 key: "call",
29 value: function call() {
30 babelHelpers.get(babelHelpers.getPrototypeOf(Obj.prototype), "test", this).call(this, 1, 2, 3);
31 babelHelpers.get(babelHelpers.getPrototypeOf(Obj.prototype), "test", this).call(this, 1, ...[2, 3]);
32 babelHelpers.get(babelHelpers.getPrototypeOf(Obj.prototype), "test", this).call(this, ...[1, 2, 3]);
33 return babelHelpers.get(babelHelpers.getPrototypeOf(Obj.prototype), "test", this).apply(this, arguments);
34 }
35 }, {
36 key: "test",
37 value: function test() {
38 throw new Error("called");
39 }
40 }]);
41 return Obj;
42 }(Base);
43 const obj = new Obj();
44 expect(obj.call(1, 2, 3)).toBe(1);