From 55e858010b9ba53c27475d9ce6f864a84d28fa81 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 14 Jul 2018 18:30:28 +0200 Subject: Resolve function overload via the argument reversal to untyped --- build2/functions-filesystem.cxx | 64 ++++------------------------------------- 1 file changed, 5 insertions(+), 59 deletions(-) (limited to 'build2/functions-filesystem.cxx') diff --git a/build2/functions-filesystem.cxx b/build2/functions-filesystem.cxx index e7578b2..5236824 100644 --- a/build2/functions-filesystem.cxx +++ b/build2/functions-filesystem.cxx @@ -187,64 +187,17 @@ namespace build2 return path_match (pattern, name); }; - f["path_match"] = [](string pattern, names name) - { - return path_match (pattern, convert (move (name))); - }; - - f["path_match"] = [](names pattern, string name) - { - return path_match (convert (move (pattern)), name); - }; - // Path matching. // - // path path * - // f["path_match"] = [](path pat, path ent, optional start) { return path_match (pat, ent, start); }; - f["path_match"] = [](path pat, path ent, names start) - { - return path_match (pat, ent, convert (move (start))); - }; - - // path untyped * - // - f["path_match"] = [](path pat, names ent, optional start) - { - return path_match (pat, convert (move (ent)), start); - }; - - f["path_match"] = [](path pat, names ent, names start) - { - return path_match (pat, - convert (move (ent)), - convert (move (start))); - }; - - // untyped path * - // - f["path_match"] = [](names pat, path ent, optional start) - { - return path_match (convert (move (pat)), ent, start); - }; - - f["path_match"] = [](names pat, path ent, names start) - { - return path_match (convert (move (pat)), - ent, - convert (move (start))); - }; - // The semantics depends on the presence of the start directory or the // first two argument syntactic representation. // - // untyped untyped * - // - f["path_match"] = [](names pat, names ent, optional start) + f["path_match"] = [](names pat, names ent, optional start) { auto path_arg = [] (const names& a) -> bool { @@ -257,18 +210,11 @@ namespace build2 return start || path_arg (pat) || path_arg (ent) ? path_match (convert (move (pat)), // Match as paths. convert (move (ent)), - start) - : path_match (convert (move (pat)), // Match as names. + start + ? convert (move (*start)) + : optional ()) + : path_match (convert (move (pat)), // Match as strings. convert (move (ent))); }; - - f["path_match"] = [](names pat, names ent, names start) - { - // Match as paths. - // - return path_match (convert (move (pat)), - convert (move (ent)), - convert (move (start))); - }; } } -- cgit v1.1