Allow dot operator on function results; change debug print info for function registration.
This commit is contained in:
parent
42fe5e8b95
commit
d2296ab33b
12
src/api.rs
12
src/api.rs
@ -17,13 +17,13 @@ impl<'a> Engine<'a> {
|
|||||||
f: Box<FnAny>,
|
f: Box<FnAny>,
|
||||||
) {
|
) {
|
||||||
debug_println!(
|
debug_println!(
|
||||||
"Register function: {} ({})",
|
"Register function: {} for {} parameter(s)",
|
||||||
fn_name,
|
fn_name,
|
||||||
args.iter()
|
if let Some(a) = &args {
|
||||||
.map(|x| (*x).type_name())
|
format!("{}", a.len())
|
||||||
.map(|name| self.map_type_name(name))
|
} else {
|
||||||
.collect::<Vec<_>>()
|
"no".to_string()
|
||||||
.join(", ")
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
let spec = FnSpec {
|
let spec = FnSpec {
|
||||||
|
@ -430,8 +430,13 @@ impl Engine<'_> {
|
|||||||
value
|
value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// {expr}.???
|
||||||
|
expr => {
|
||||||
|
let mut target = self.eval_expr(scope, expr)?;
|
||||||
|
self.get_dot_val_helper(scope, target.as_mut(), dot_rhs)
|
||||||
|
}
|
||||||
// Syntax error
|
// Syntax error
|
||||||
_ => Err(EvalAltResult::ErrorDotExpr(dot_lhs.position())),
|
//_ => Err(EvalAltResult::ErrorDotExpr(dot_lhs.position())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user