use super::{HelperDef, HelperName};
pub const DEF: HelperDef = HelperDef {
name: HelperName::call_super,
local: "_call_super",
import_path: "@swc/helpers/_/_call_super",
#[cfg(feature = "inline-helpers")]
source: r#"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)
);
}
"#,
#[cfg(feature = "inline-helpers")]
deps: super::HelperBitmap::from_bits(0x00000002000004002008000000002040),
};
#[cfg(feature = "inline-helpers")]
pub fn stmts() -> &'static [swc_ecma_ast::Stmt] {
static STMTS: once_cell::sync::Lazy<Vec<swc_ecma_ast::Stmt>> =
once_cell::sync::Lazy::new(|| super::super::parse(DEF.source, DEF.import_path));
&STMTS
}