diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-30 17:32:43 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-30 17:32:43 +0200 |
commit | be14801929cf2a6caced87df034ae12a85f42aa6 (patch) | |
tree | 74670e0a746961424e50c09449d526e143c1abfc /build2/function | |
parent | 4b31ef06275ad423e48a75d15fb0ee21c3127e3c (diff) |
Add support for typed/untyped concatenated expansion
Diffstat (limited to 'build2/function')
-rw-r--r-- | build2/function | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/build2/function b/build2/function index 6397720..f824f9c 100644 --- a/build2/function +++ b/build2/function @@ -145,7 +145,23 @@ namespace build2 erase (iterator i) {map_.erase (i);} value - call (const string& name, vector_view<value> args, const location&) const; + call (const string& name, vector_view<value> args, const location& l) const + { + return call (name, args, l, true).first; + } + + // As above but do not fail if no match was found (but still do if the + // match is ambiguous). Instead return an indication of whether the call + // was made. Used to issue custom diagnostics when calling internal + // functions. + // + pair<value, bool> + try_call (const string& name, + vector_view<value> args, + const location& l) const + { + return call (name, args, l, false); + } iterator begin () {return map_.begin ();} @@ -160,6 +176,9 @@ namespace build2 end () const {return map_.end ();} private: + pair<value, bool> + call (const string&, vector_view<value>, const location&, bool fail) const; + map_type map_; }; |