summaryrefslogtreecommitdiff
path: root/src/projection.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/projection.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/projection.cc')
-rw-r--r--src/projection.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/projection.cc b/src/projection.cc
index 1fcf639..46add48 100644
--- a/src/projection.cc
+++ b/src/projection.cc
@@ -26,7 +26,7 @@
#include "projectionnode.h"
#include "module.h"
-#include "context.h"
+#include "evalcontext.h"
#include "printutils.h"
#include "builtin.h"
#include "visitor.h"
@@ -41,10 +41,10 @@ class ProjectionModule : public AbstractModule
{
public:
ProjectionModule() { }
- virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
+ virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst, const EvalContext *evalctx) const;
};
-AbstractNode *ProjectionModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const
+AbstractNode *ProjectionModule::evaluate(const Context *ctx, const ModuleInstantiation *inst, const EvalContext *evalctx) const
{
ProjectionNode *node = new ProjectionNode(inst);
@@ -53,7 +53,7 @@ AbstractNode *ProjectionModule::evaluate(const Context *ctx, const ModuleInstant
std::vector<Expression*> argexpr;
Context c(ctx);
- c.args(argnames, argexpr, inst->argnames, inst->argvalues);
+ c.setVariables(argnames, argexpr, evalctx);
Value convexity = c.lookup_variable("convexity", true);
Value cut = c.lookup_variable("cut", true);
@@ -63,7 +63,7 @@ AbstractNode *ProjectionModule::evaluate(const Context *ctx, const ModuleInstant
if (cut.type() == Value::BOOL)
node->cut_mode = cut.toBool();
- std::vector<AbstractNode *> evaluatednodes = inst->evaluateChildren();
+ std::vector<AbstractNode *> evaluatednodes = inst->evaluateChildren(evalctx);
node->children.insert(node->children.end(), evaluatednodes.begin(), evaluatednodes.end());
return node;
contact: Jan Huwald // Impressum