applyDecs2311.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. var _typeof = require("./typeof.js")["default"];
  2. var checkInRHS = require("./checkInRHS.js");
  3. var setFunctionName = require("./setFunctionName.js");
  4. var toPropertyKey = require("./toPropertyKey.js");
  5. function applyDecs2311(e, t, n, r, o, i) {
  6. var a,
  7. c,
  8. u,
  9. s,
  10. f,
  11. l,
  12. p,
  13. d = Symbol.metadata || Symbol["for"]("Symbol.metadata"),
  14. m = Object.defineProperty,
  15. h = Object.create,
  16. y = [h(null), h(null)],
  17. v = t.length;
  18. function g(t, n, r) {
  19. return function (o, i) {
  20. n && (i = o, o = e);
  21. for (var a = 0; a < t.length; a++) i = t[a].apply(o, r ? [i] : []);
  22. return r ? i : o;
  23. };
  24. }
  25. function b(e, t, n, r) {
  26. if ("function" != typeof e && (r || void 0 !== e)) throw new TypeError(t + " must " + (n || "be") + " a function" + (r ? "" : " or undefined"));
  27. return e;
  28. }
  29. function applyDec(e, t, n, r, o, i, u, s, f, l, p) {
  30. function d(e) {
  31. if (!p(e)) throw new TypeError("Attempted to access private element on non-instance");
  32. }
  33. var h = [].concat(t[0]),
  34. v = t[3],
  35. w = !u,
  36. D = 1 === o,
  37. S = 3 === o,
  38. j = 4 === o,
  39. E = 2 === o;
  40. function I(t, n, r) {
  41. return function (o, i) {
  42. return n && (i = o, o = e), r && r(o), P[t].call(o, i);
  43. };
  44. }
  45. if (!w) {
  46. var P = {},
  47. k = [],
  48. F = S ? "get" : j || D ? "set" : "value";
  49. if (f ? (l || D ? P = {
  50. get: setFunctionName(function () {
  51. return v(this);
  52. }, r, "get"),
  53. set: function set(e) {
  54. t[4](this, e);
  55. }
  56. } : P[F] = v, l || setFunctionName(P[F], r, E ? "" : F)) : l || (P = Object.getOwnPropertyDescriptor(e, r)), !l && !f) {
  57. if ((c = y[+s][r]) && 7 != (c ^ o)) throw Error("Decorating two elements with the same name (" + P[F].name + ") is not supported yet");
  58. y[+s][r] = o < 3 ? 1 : o;
  59. }
  60. }
  61. for (var N = e, O = h.length - 1; O >= 0; O -= n ? 2 : 1) {
  62. var T = b(h[O], "A decorator", "be", !0),
  63. z = n ? h[O - 1] : void 0,
  64. A = {},
  65. H = {
  66. kind: ["field", "accessor", "method", "getter", "setter", "class"][o],
  67. name: r,
  68. metadata: a,
  69. addInitializer: function (e, t) {
  70. if (e.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
  71. b(t, "An initializer", "be", !0), i.push(t);
  72. }.bind(null, A)
  73. };
  74. if (w) c = T.call(z, N, H), A.v = 1, b(c, "class decorators", "return") && (N = c);else if (H["static"] = s, H["private"] = f, c = H.access = {
  75. has: f ? p.bind() : function (e) {
  76. return r in e;
  77. }
  78. }, j || (c.get = f ? E ? function (e) {
  79. return d(e), P.value;
  80. } : I("get", 0, d) : function (e) {
  81. return e[r];
  82. }), E || S || (c.set = f ? I("set", 0, d) : function (e, t) {
  83. e[r] = t;
  84. }), N = T.call(z, D ? {
  85. get: P.get,
  86. set: P.set
  87. } : P[F], H), A.v = 1, D) {
  88. if ("object" == _typeof(N) && N) (c = b(N.get, "accessor.get")) && (P.get = c), (c = b(N.set, "accessor.set")) && (P.set = c), (c = b(N.init, "accessor.init")) && k.unshift(c);else if (void 0 !== N) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
  89. } else b(N, (l ? "field" : "method") + " decorators", "return") && (l ? k.unshift(N) : P[F] = N);
  90. }
  91. return o < 2 && u.push(g(k, s, 1), g(i, s, 0)), l || w || (f ? D ? u.splice(-1, 0, I("get", s), I("set", s)) : u.push(E ? P[F] : b.call.bind(P[F])) : m(e, r, P)), N;
  92. }
  93. function w(e) {
  94. return m(e, d, {
  95. configurable: !0,
  96. enumerable: !0,
  97. value: a
  98. });
  99. }
  100. return void 0 !== i && (a = i[d]), a = h(null == a ? null : a), f = [], l = function l(e) {
  101. e && f.push(g(e));
  102. }, p = function p(t, r) {
  103. for (var i = 0; i < n.length; i++) {
  104. var a = n[i],
  105. c = a[1],
  106. l = 7 & c;
  107. if ((8 & c) == t && !l == r) {
  108. var p = a[2],
  109. d = !!a[3],
  110. m = 16 & c;
  111. applyDec(t ? e : e.prototype, a, m, d ? "#" + p : toPropertyKey(p), l, l < 2 ? [] : t ? s = s || [] : u = u || [], f, !!t, d, r, t && d ? function (t) {
  112. return checkInRHS(t) === e;
  113. } : o);
  114. }
  115. }
  116. }, p(8, 0), p(0, 0), p(8, 1), p(0, 1), l(u), l(s), c = f, v || w(e), {
  117. e: c,
  118. get c() {
  119. var n = [];
  120. return v && [w(e = applyDec(e, [t], r, e.name, 5, n)), g(n, 1)];
  121. }
  122. };
  123. }
  124. module.exports = applyDecs2311, module.exports.__esModule = true, module.exports["default"] = module.exports;