From 334c71cd07fde10616bb6116316dbd86dbe5e3e0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 3 May 2011 09:21:27 +0000 Subject: [PATCH] * Use default values of job function arguments if they're not specified in Hydra. --- src/c/hydra_eval_jobs.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/c/hydra_eval_jobs.cc b/src/c/hydra_eval_jobs.cc index 0618d923..c7de83f5 100644 --- a/src/c/hydra_eval_jobs.cc +++ b/src/c/hydra_eval_jobs.cc @@ -49,13 +49,17 @@ static void tryJobAlts(EvalState & state, XMLWriter & doc, return; } + Formals::Formals_::iterator next = cur; ++next; + 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) {