From 61405ec58aceddfa0b3db76002fc4bf018e92340 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 29 Mar 2013 01:14:24 +0100 Subject: [PATCH] hydra-eval-jobs: Use function argument default values --- src/c/hydra-eval-jobs.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/c/hydra-eval-jobs.cc b/src/c/hydra-eval-jobs.cc index 8c003a84..4ff01057 100644 --- a/src/c/hydra-eval-jobs.cc +++ b/src/c/hydra-eval-jobs.cc @@ -52,12 +52,16 @@ static void tryJobAlts(EvalState & state, XMLWriter & doc, AutoArgs::const_iterator a = argsLeft.find(cur->name); - if (a == argsLeft.end()) - throw TypeError(format("job `%1%' requires an argument named `%2%'") - % attrPath % cur->name); - Formals::Formals_::iterator next = cur; ++next; + if (a == argsLeft.end()) { + if (!cur->def) + throw TypeError(format("job `%1%' requires an argument named `%2%'") + % attrPath % cur->name); + tryJobAlts(state, doc, argsUsed, argsLeft, attrPath, fun, next, last, actualArgs); + return; + } + int n = 0; foreach (ValueList::const_iterator, i, a->second) { Bindings actualArgs2(actualArgs); // !!! inefficient