Merge branch 'master' into plugins

This commit is contained in:
Stephen Chung
2020-06-08 10:26:51 +08:00
6 changed files with 108 additions and 21 deletions

View File

@@ -708,7 +708,11 @@ impl Engine {
"{} ({})",
fn_name,
args.iter()
.map(|name| self.map_type_name(name.type_name()))
.map(|name| if name.is::<ImmutableString>() {
"&str | ImmutableString"
} else {
self.map_type_name(name.type_name())
})
.collect::<Vec<_>>()
.join(", ")
),
@@ -906,6 +910,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 +1299,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 +1313,12 @@ impl Engine {
))
})
}
#[cfg(feature = "no_index")]
_ => Err(Box::new(EvalAltResult::ErrorIndexingType(
self.map_type_name(val.type_name()).into(),
Position::none(),
))),
}
}