mirror of
https://github.com/swc-project/swc.git
synced 2024-11-29 11:47:21 +03:00
69719c2acb
**Description:** Helper methods were exporting twice, `_` and it's own function name. We can map the build script to export `_` as it's own name (filename). Therefore we export only once as `_`, and map the name on the build script. ```js // helpers/_foo.js function _foo() { // ... } export { _foo as _ } ``` ```js // index.js // We know the func name will be `_foo` based on the filename. export { _ as _foo } from '_foo.js' ``` Closes #9203 --------- Co-authored-by: magic-akari <akari.ccino@gmail.com>
24 lines
746 B
JavaScript
24 lines
746 B
JavaScript
function _class_apply_descriptor_destructure(receiver, descriptor) {
|
|
if (descriptor.set) {
|
|
if (!("__destrObj" in descriptor)) {
|
|
descriptor.__destrObj = {
|
|
set value(v) {
|
|
descriptor.set.call(receiver, v);
|
|
}
|
|
};
|
|
}
|
|
|
|
return descriptor.__destrObj;
|
|
} 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");
|
|
}
|
|
|
|
return descriptor;
|
|
}
|
|
}
|
|
export { _class_apply_descriptor_destructure as _ };
|