Use &Val for submov key

This commit is contained in:
Andrew Morris
2023-06-20 14:26:36 +10:00
parent 0bafbc74e4
commit 7e16156933
15 changed files with 18 additions and 18 deletions

View File

@@ -70,7 +70,7 @@ where
Ok(Self::bo_sub(&key.to_string()))
}
fn submov(&mut self, _key: Val, _value: Val) -> Result<(), Val> {
fn submov(&mut self, _key: &Val, _value: Val) -> Result<(), Val> {
Err(format!("Cannot assign to subscript of {} builtin", Self::bo_name()).to_type_error())
}

View File

@@ -98,7 +98,7 @@ static SET_MESSAGE: NativeFunction = native_fn(|mut this, params| {
None => "".to_string(),
};
op_submov(this.get_mut()?, "message".to_val(), message.to_val())?;
op_submov(this.get_mut()?, &"message".to_val(), message.to_val())?;
Ok(Val::Undefined)
});

View File

@@ -62,7 +62,7 @@ static SET_MESSAGE: NativeFunction = native_fn(|mut this, params| {
None => "".to_string(),
};
op_submov(this.get_mut()?, "message".to_val(), message.to_val())?;
op_submov(this.get_mut()?, &"message".to_val(), message.to_val())?;
Ok(Val::Undefined)
});

View File

@@ -70,7 +70,7 @@ static SET_MESSAGE: NativeFunction = native_fn(|mut this, params| {
None => "".to_string(),
};
op_submov(this.get_mut()?, "message".to_val(), message.to_val())?;
op_submov(this.get_mut()?, &"message".to_val(), message.to_val())?;
Ok(Val::Undefined)
});