classPrivateFieldSet.js 463 B

12345678910111213141516171819
  1. export default function _classPrivateFieldSet(receiver, privateMap, value) {
  2. var descriptor = privateMap.get(receiver);
  3. if (!descriptor) {
  4. throw new TypeError("attempted to set private field on non-instance");
  5. }
  6. if (descriptor.set) {
  7. descriptor.set.call(receiver, value);
  8. } else {
  9. if (!descriptor.writable) {
  10. throw new TypeError("attempted to set read only private field");
  11. }
  12. descriptor.value = value;
  13. }
  14. return value;
  15. }