swc/packages/helpers/esm/_call_super.js
magic-akari 4b85a92170
Some checks are pending
CI / Cargo fmt (push) Waiting to run
CI / Cargo clippy (push) Waiting to run
CI / Check license of dependencies (push) Waiting to run
CI / Check (macos-latest) (push) Waiting to run
CI / Check (ubuntu-latest) (push) Waiting to run
CI / Check (windows-latest) (push) Waiting to run
CI / Test wasm (binding_core_wasm) (push) Waiting to run
CI / Test wasm (binding_minifier_wasm) (push) Waiting to run
CI / Test wasm (binding_typescript_wasm) (push) Waiting to run
CI / List crates (push) Waiting to run
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Blocked by required conditions
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Waiting to run
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Waiting to run
CI / Test with @swc/cli (push) Waiting to run
CI / Miri (better_scoped_tls) (push) Waiting to run
CI / Miri (string_enum) (push) Waiting to run
CI / Miri (swc) (push) Waiting to run
CI / Miri (swc_bundler) (push) Waiting to run
CI / Miri (swc_ecma_codegen) (push) Waiting to run
CI / Miri (swc_ecma_minifier) (push) Waiting to run
CI / Done (push) Blocked by required conditions
Benchmark / Bench everything (push) Waiting to run
perf(es/compat): Reimplement constructor transform (#9519)
**Related issue:**

- Closes #9494 
- babel/babel#16194
2024-09-02 19:53:16 +09:00

18 lines
694 B
JavaScript

import { _ as _get_prototype_of } from "./_get_prototype_of.js";
import { _ as _is_native_reflect_construct } from "./_is_native_reflect_construct.js";
import { _ as _possible_constructor_return } from "./_possible_constructor_return.js";
function _call_super(_this, derived, args) {
// Super
derived = _get_prototype_of(derived);
return _possible_constructor_return(
_this,
_is_native_reflect_construct()
// NOTE: This doesn't work if this.__proto__.constructor has been modified.
? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor)
: derived.apply(_this, args)
);
}
export { _call_super as _ };