Move += for ImmutableString to Engine.
This commit is contained in:
parent
854634afa0
commit
0b259d0062
@ -18,10 +18,7 @@ use crate::utils::StaticVec;
|
|||||||
use crate::parser::FLOAT;
|
use crate::parser::FLOAT;
|
||||||
|
|
||||||
#[cfg(not(feature = "no_module"))]
|
#[cfg(not(feature = "no_module"))]
|
||||||
use crate::module::{resolvers, ModuleRef, ModuleResolver};
|
use crate::module::{resolvers, ModuleResolver};
|
||||||
|
|
||||||
#[cfg(feature = "no_module")]
|
|
||||||
use crate::parser::ModuleRef;
|
|
||||||
|
|
||||||
use crate::stdlib::{
|
use crate::stdlib::{
|
||||||
any::TypeId,
|
any::TypeId,
|
||||||
@ -30,7 +27,6 @@ use crate::stdlib::{
|
|||||||
format,
|
format,
|
||||||
iter::{empty, once},
|
iter::{empty, once},
|
||||||
mem,
|
mem,
|
||||||
num::NonZeroUsize,
|
|
||||||
ops::{Deref, DerefMut},
|
ops::{Deref, DerefMut},
|
||||||
string::{String, ToString},
|
string::{String, ToString},
|
||||||
vec::Vec,
|
vec::Vec,
|
||||||
@ -2186,6 +2182,14 @@ fn run_builtin_op_assignment(
|
|||||||
"|=" => return Ok(Some(*x = *x || y)),
|
"|=" => return Ok(Some(*x = *x || y)),
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
} else if args_type == TypeId::of::<ImmutableString>() {
|
||||||
|
let x = x.downcast_mut::<ImmutableString>().unwrap();
|
||||||
|
let y = y.downcast_ref::<ImmutableString>().unwrap();
|
||||||
|
|
||||||
|
match op {
|
||||||
|
"+=" => return Ok(Some(*x += y)),
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "no_float"))]
|
#[cfg(not(feature = "no_float"))]
|
||||||
|
@ -81,6 +81,5 @@ def_package!(crate:BasicStringPackage:"Basic string utilities, including printin
|
|||||||
lib.set_fn_2("+", |s: ImmutableString, ch: char| Ok(s + ch));
|
lib.set_fn_2("+", |s: ImmutableString, ch: char| Ok(s + ch));
|
||||||
lib.set_fn_2_mut("+=", |s: &mut ImmutableString, ch: char| { *s += ch; Ok(()) });
|
lib.set_fn_2_mut("+=", |s: &mut ImmutableString, ch: char| { *s += ch; Ok(()) });
|
||||||
lib.set_fn_2_mut("append", |s: &mut ImmutableString, ch: char| { *s += ch; Ok(()) });
|
lib.set_fn_2_mut("append", |s: &mut ImmutableString, ch: char| { *s += ch; Ok(()) });
|
||||||
lib.set_fn_2_mut("+=", |s: &mut ImmutableString, s2: ImmutableString| { *s += &s2; Ok(()) });
|
|
||||||
lib.set_fn_2_mut("append", |s: &mut ImmutableString, s2: ImmutableString| { *s += &s2; Ok(()) });
|
lib.set_fn_2_mut("append", |s: &mut ImmutableString, s2: ImmutableString| { *s += &s2; Ok(()) });
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user