Skip to main content

super_construct

Function super_construct 

Source
pub fn super_construct(
    parent: &Value,
    args: Vec<Value>,
    inst: &Value,
    new_target: &Value,
) -> Result<Option<Value>, String>
Expand description

Run a parent constructor as part of super(...): dispatch on the parent’s kind (class vs plain function vs builtin) using the existing instance. Run the parent constructor against inst.

Returns the object the parent’s [[Construct]] produced when that is NOT inst — a base constructor is allowed to return one, and 15.7.15 makes it the derived instance too. The caller rebinds this to it, so the rest of the derived constructor writes to the object new will hand back.