summaryrefslogtreecommitdiff
path: root/src/expr.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2013-04-09 04:28:16 (GMT)
committerMarius Kintel <marius@kintel.net>2013-04-09 04:28:16 (GMT)
commita37813a8999571f4b9235f33fdc7c22bcbe5fd17 (patch)
tree266d8c106100edab9f51b93cf229cf55cd083918 /src/expr.cc
parentb16c24fb2888d932ec035fff27cb29b4ffbc256b (diff)
Refactored context handling into using separate Module contexts and Eval contexts. This allows for recursive module calls, and cascading children. I believe this fixes issue #116
Diffstat (limited to 'src/expr.cc')
-rw-r--r--src/expr.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/expr.cc b/src/expr.cc
index 75fc47a..1d7b440 100644
--- a/src/expr.cc
+++ b/src/expr.cc
@@ -26,7 +26,7 @@
#include "expression.h"
#include "value.h"
-#include "context.h"
+#include "evalcontext.h"
#include <assert.h>
#include <sstream>
#include <algorithm>
@@ -127,13 +127,18 @@ Value Expression::evaluate(const Context *context) const
return Value();
}
if (this->type == "F") {
- Value::VectorType argvalues;
- std::transform(this->children.begin(), this->children.end(),
- std::back_inserter(argvalues),
- boost::bind(&Expression::evaluate, _1, context));
+ EvalContext c(context);
+ for (size_t i=0; i < this->children.size(); i++) {
+ c.eval_arguments.push_back(std::make_pair(this->call_argnames[i],
+ this->children[i]->evaluate(context)));
+ }
+ // Value::VectorType argvalues;
+ // std::transform(this->children.begin(), this->children.end(),
+ // std::back_inserter(argvalues),
+ // boost::bind(&Expression::evaluate, _1, context));
// for (size_t i=0; i < this->children.size(); i++)
// argvalues.push_back(this->children[i]->evaluate(context));
- return context->evaluate_function(this->call_funcname, this->call_argnames, argvalues);
+ return context->evaluate_function(this->call_funcname, &c);
}
abort();
}
contact: Jan Huwald // Impressum