From d2296ab33bda8e4de7cb68f6a8daf17512e00494 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Fri, 6 Mar 2020 15:49:38 +0800 Subject: [PATCH] Allow dot operator on function results; change debug print info for function registration. --- src/api.rs | 12 ++++++------ src/engine.rs | 7 ++++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/api.rs b/src/api.rs index 49553624..b27378f2 100644 --- a/src/api.rs +++ b/src/api.rs @@ -17,13 +17,13 @@ impl<'a> Engine<'a> { f: Box, ) { debug_println!( - "Register function: {} ({})", + "Register function: {} for {} parameter(s)", fn_name, - args.iter() - .map(|x| (*x).type_name()) - .map(|name| self.map_type_name(name)) - .collect::>() - .join(", ") + if let Some(a) = &args { + format!("{}", a.len()) + } else { + "no".to_string() + } ); let spec = FnSpec { diff --git a/src/engine.rs b/src/engine.rs index 48b57199..b00db1f9 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -430,8 +430,13 @@ impl Engine<'_> { value } + // {expr}.??? + expr => { + let mut target = self.eval_expr(scope, expr)?; + self.get_dot_val_helper(scope, target.as_mut(), dot_rhs) + } // Syntax error - _ => Err(EvalAltResult::ErrorDotExpr(dot_lhs.position())), + //_ => Err(EvalAltResult::ErrorDotExpr(dot_lhs.position())), } }