diff --git a/chaiscript/chaiscript_eval.hpp b/chaiscript/chaiscript_eval.hpp index dc64b7dd..697c074a 100644 --- a/chaiscript/chaiscript_eval.hpp +++ b/chaiscript/chaiscript_eval.hpp @@ -19,9 +19,9 @@ namespace chaiscript std::string reason; langkit::TokenPtr location; - EvalError(const std::string &why, const langkit::TokenPtr where) - : std::runtime_error("Eval error: \"" + why + "\" in '" - + where->filename + "' line: " + boost::lexical_cast(where->start.line+1)), + EvalError(const std::string &why, const langkit::TokenPtr where) + : std::runtime_error("Eval error: \"" + why + "\" in '" + + where->filename + "' line: " + boost::lexical_cast(where->start.line+1)), reason(why), location(where) { } virtual ~EvalError() throw() {} @@ -431,7 +431,7 @@ namespace chaiscript } ss.register_function(boost::shared_ptr( - new dispatchkit::Dynamic_Proxy_Function(boost::bind(&eval_function, boost::ref(ss), node->children.back(), param_names, _1))), node->children[0]->text); + new dispatchkit::Dynamic_Proxy_Function(boost::bind(&eval_function, boost::ref(ss), node->children.back(), param_names, _1), num_args)), node->children[0]->text); } break; case (TokenType::Lambda_Def) : { @@ -444,7 +444,7 @@ namespace chaiscript //retval = boost::shared_ptr(new dispatchkit::Proxy_Function_Impl >(&test)); retval = dispatchkit::Boxed_Value(boost::shared_ptr( new dispatchkit::Dynamic_Proxy_Function( - boost::bind(&eval_function, boost::ref(ss), node->children.back(), param_names, _1)))); + boost::bind(&eval_function, boost::ref(ss), node->children.back(), param_names, _1), num_args))); } break; case (TokenType::Scoped_Block) : { diff --git a/samples/bind.chai b/samples/bind.chai index 71e699ac..40543572 100644 --- a/samples/bind.chai +++ b/samples/bind.chai @@ -27,4 +27,5 @@ def concat(a,b,c,d) var d = bind(concat, _(), " Hello ", _(), " World "); print(d(1, 3)); -print(d(1, 3, 4)); +//This checks to make sure arity is handled correctly: +//print(d(1, 3, 4));