(
mc: &'gc Mutation<'gc>,
receiver: Value<'gc>,
args: Vec<Value<'gc>>,
)
| 388 | } |
| 389 | |
| 390 | fn replace<'gc>( |
| 391 | mc: &'gc Mutation<'gc>, |
| 392 | receiver: Value<'gc>, |
| 393 | args: Vec<Value<'gc>>, |
| 394 | ) -> Result<Value<'gc>, VmError> { |
| 395 | let from = string_arg!(&args, 0, "replace")?; |
| 396 | let to = string_arg!(&args, 1, "replace")?; |
| 397 | |
| 398 | let result = receiver |
| 399 | .as_string()? |
| 400 | .to_str() |
| 401 | .unwrap() |
| 402 | .replace(from.to_str().unwrap(), to.to_str().unwrap()); |
| 403 | // Ok(Value::String(mc.intern(result.as_bytes()))) |
| 404 | Ok(Value::IoString(Gc::new(mc, result))) |
| 405 | } |
no test coverage detected