You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
653 B

4 years ago
  1. function _classPrivateFieldDestructureSet(receiver, privateMap) {
  2. if (!privateMap.has(receiver)) {
  3. throw new TypeError("attempted to set private field on non-instance");
  4. }
  5. var descriptor = privateMap.get(receiver);
  6. if (descriptor.set) {
  7. if (!("__destrObj" in descriptor)) {
  8. descriptor.__destrObj = {
  9. set value(v) {
  10. descriptor.set.call(receiver, v);
  11. }
  12. };
  13. }
  14. return descriptor.__destrObj;
  15. } else {
  16. if (!descriptor.writable) {
  17. throw new TypeError("attempted to set read only private field");
  18. }
  19. return descriptor;
  20. }
  21. }
  22. module.exports = _classPrivateFieldDestructureSet;