Rename types_match to call_match in Proxy_Function to more closely match the semantics of the call

This commit is contained in:
Jason Turner 2009-08-06 01:35:12 +00:00
parent ba6b392174
commit 0ff107a818
3 changed files with 11 additions and 12 deletions

View File

@ -635,7 +635,7 @@ namespace chaiscript
Proxy_Function f = boxed_cast<Proxy_Function >(params[0]); Proxy_Function f = boxed_cast<Proxy_Function >(params[0]);
return Boxed_Value(f->types_match(std::vector<Boxed_Value>(params.begin() + 1, params.end()))); return Boxed_Value(f->call_match(std::vector<Boxed_Value>(params.begin() + 1, params.end())));
} }
static boost::shared_ptr<Dispatch_Engine> bootstrap2(boost::shared_ptr<Dispatch_Engine> e = boost::shared_ptr<Dispatch_Engine> (new Dispatch_Engine())) static boost::shared_ptr<Dispatch_Engine> bootstrap2(boost::shared_ptr<Dispatch_Engine> e = boost::shared_ptr<Dispatch_Engine> (new Dispatch_Engine()))

View File

@ -94,7 +94,7 @@ namespace chaiscript
return std::vector<Type_Info>(); return std::vector<Type_Info>();
} }
virtual bool types_match(const std::vector<Boxed_Value> &types) const virtual bool call_match(const std::vector<Boxed_Value> &vals) const
{ {
typedef std::vector<std::pair<std::string, Proxy_Function > > function_vec; typedef std::vector<std::pair<std::string, Proxy_Function > > function_vec;
@ -103,7 +103,7 @@ namespace chaiscript
while (begin != end) while (begin != end)
{ {
if (begin->second->types_match(types)) if (begin->second->call_match(vals))
{ {
return true; return true;
} else { } else {

View File

@ -177,7 +177,7 @@ namespace chaiscript
virtual Boxed_Value operator()(const std::vector<Boxed_Value> &params) = 0; virtual Boxed_Value operator()(const std::vector<Boxed_Value> &params) = 0;
virtual std::vector<Type_Info> get_param_types() const = 0; virtual std::vector<Type_Info> get_param_types() const = 0;
virtual bool operator==(const Proxy_Function_Base &) const = 0; virtual bool operator==(const Proxy_Function_Base &) const = 0;
virtual bool types_match(const std::vector<Boxed_Value> &types) const = 0; virtual bool call_match(const std::vector<Boxed_Value> &vals) const = 0;
virtual std::string annotation() const = 0; virtual std::string annotation() const = 0;
}; };
@ -218,10 +218,10 @@ namespace chaiscript
return false; return false;
} }
virtual bool types_match(const std::vector<Boxed_Value> &types) const virtual bool call_match(const std::vector<Boxed_Value> &vals) const
{ {
return (m_arity < 0 || types.size() == size_t(m_arity)) return (m_arity < 0 || vals.size() == size_t(m_arity))
&& test_guard(types); && test_guard(vals);
} }
virtual ~Dynamic_Proxy_Function() {} virtual ~Dynamic_Proxy_Function() {}
@ -320,10 +320,9 @@ namespace chaiscript
virtual ~Bound_Function() {} virtual ~Bound_Function() {}
virtual bool types_match(const std::vector<Boxed_Value> &types) const virtual bool call_match(const std::vector<Boxed_Value> &vals) const
{ {
std::vector<Boxed_Value> params = build_param_list(types); return m_f->call_match(build_param_list(vals));
return m_f->types_match(params);
} }
virtual Boxed_Value operator()(const std::vector<Boxed_Value> &params) virtual Boxed_Value operator()(const std::vector<Boxed_Value> &params)
@ -421,10 +420,10 @@ namespace chaiscript
return build_param_type_list(f); return build_param_type_list(f);
} }
virtual bool types_match(const std::vector<Boxed_Value> &types) const virtual bool call_match(const std::vector<Boxed_Value> &vals) const
{ {
Func *f = 0; Func *f = 0;
return compare_types(f, types); return compare_types(f, vals);
} }
virtual std::string annotation() const virtual std::string annotation() const