|
|
@ -235,15 +235,20 @@ pub fn new_function_environment( |
|
|
|
outer: Option<Environment>, |
|
|
|
outer: Option<Environment>, |
|
|
|
binding_status: BindingStatus, |
|
|
|
binding_status: BindingStatus, |
|
|
|
) -> Environment { |
|
|
|
) -> Environment { |
|
|
|
Gc::new(GcCell::new(Box::new(FunctionEnvironmentRecord { |
|
|
|
let mut func_env = FunctionEnvironmentRecord { |
|
|
|
env_rec: FxHashMap::default(), |
|
|
|
env_rec: FxHashMap::default(), |
|
|
|
function: f, |
|
|
|
function: f, |
|
|
|
this_binding_status: binding_status, |
|
|
|
this_binding_status: binding_status, |
|
|
|
home_object: Value::undefined(), |
|
|
|
home_object: Value::undefined(), |
|
|
|
new_target: Value::undefined(), |
|
|
|
new_target: Value::undefined(), |
|
|
|
outer_env: outer, // this will come from Environment set as a private property of F - https://tc39.es/ecma262/#sec-ecmascript-function-objects
|
|
|
|
outer_env: outer, // this will come from Environment set as a private property of F - https://tc39.es/ecma262/#sec-ecmascript-function-objects
|
|
|
|
this_value: this.unwrap_or_else(Value::undefined), |
|
|
|
this_value: Value::undefined(), |
|
|
|
}))) |
|
|
|
}; |
|
|
|
|
|
|
|
// If a `this` value has been passed, bind it to the environment
|
|
|
|
|
|
|
|
if let Some(v) = this { |
|
|
|
|
|
|
|
func_env.bind_this_value(v); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Gc::new(GcCell::new(Box::new(func_env))) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn new_object_environment(object: Value, environment: Option<Environment>) -> Environment { |
|
|
|
pub fn new_object_environment(object: Value, environment: Option<Environment>) -> Environment { |
|
|
|