Transparently convert &str to ImmutableString for register_fn.

This commit is contained in:
Stephen Chung
2020-06-07 17:54:33 +08:00
parent 5f40a1376a
commit e942ef358c
5 changed files with 94 additions and 12 deletions

View File

@@ -906,6 +906,9 @@ impl Engine {
let mut idx_val = idx_values.pop();
if is_index {
#[cfg(feature = "no_index")]
unreachable!();
let pos = rhs.position();
match rhs {
@@ -1292,6 +1295,7 @@ impl Engine {
}
}
#[cfg(not(feature = "no_index"))]
_ => {
let fn_name = FUNC_INDEXER_GET;
let type_name = self.map_type_name(val.type_name());
@@ -1305,6 +1309,12 @@ impl Engine {
))
})
}
#[cfg(feature = "no_index")]
_ => Err(Box::new(EvalAltResult::ErrorIndexingType(
self.map_type_name(val.type_name()).into(),
Position::none(),
))),
}
}