2023-04-04 06:05:47 +03:00
|
|
|
export function _class_apply_descriptor_update(receiver, descriptor) {
|
2022-05-02 07:34:46 +03:00
|
|
|
if (descriptor.set) {
|
2023-04-04 06:05:47 +03:00
|
|
|
if (!descriptor.get) throw new TypeError("attempted to read set only private field");
|
|
|
|
|
2022-05-02 07:34:46 +03:00
|
|
|
if (!("__destrWrapper" in descriptor)) {
|
|
|
|
descriptor.__destrWrapper = {
|
|
|
|
set value(v) {
|
|
|
|
descriptor.set.call(receiver, v);
|
|
|
|
},
|
|
|
|
get value() {
|
|
|
|
return descriptor.get.call(receiver);
|
2023-03-31 09:15:21 +03:00
|
|
|
}
|
2022-05-02 07:34:46 +03:00
|
|
|
};
|
|
|
|
}
|
2023-04-04 06:05:47 +03:00
|
|
|
|
2022-05-02 07:34:46 +03:00
|
|
|
return descriptor.__destrWrapper;
|
|
|
|
} else {
|
|
|
|
if (!descriptor.writable) {
|
|
|
|
// This should only throw in strict mode, but class bodies are
|
|
|
|
// always strict and private fields can only be used inside
|
|
|
|
// class bodies.
|
|
|
|
throw new TypeError("attempted to set read only private field");
|
|
|
|
}
|
2023-04-04 06:05:47 +03:00
|
|
|
|
2022-05-02 07:34:46 +03:00
|
|
|
return descriptor;
|
|
|
|
}
|
|
|
|
}
|
2023-04-04 06:05:47 +03:00
|
|
|
export { _class_apply_descriptor_update as _ };
|