summaryrefslogtreecommitdiff
path: root/src/module.h
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/module.h
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/module.h')
-rw-r--r--src/module.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/module.h b/src/module.h
index 1f9e303..17f0c59 100644
--- a/src/module.h
+++ b/src/module.h
@@ -11,13 +11,12 @@ class ModuleInstantiation
{
public:
ModuleInstantiation(const std::string &name = "")
- : ctx(NULL),
- tag_root(false), tag_highlight(false), tag_background(false), modname(name) { }
+ : tag_root(false), tag_highlight(false), tag_background(false), modname(name) { }
virtual ~ModuleInstantiation();
std::string dump(const std::string &indent) const;
- class AbstractNode *evaluate(const class Context *ctx) const;
- std::vector<AbstractNode*> evaluateChildren(const Context *ctx = NULL) const;
+ class AbstractNode *evaluate_instance(const class Context *ctx) const;
+ std::vector<AbstractNode*> evaluateChildren(const Context *evalctx) const;
void setPath(const std::string &path) { this->modpath = path; }
const std::string &path() const { return this->modpath; }
@@ -29,10 +28,8 @@ public:
bool isRoot() const { return this->tag_root; }
std::vector<std::string> argnames;
- std::vector<Value> argvalues;
std::vector<class Expression*> argexpr;
std::vector<ModuleInstantiation*> children;
- const Context *ctx;
bool tag_root;
bool tag_highlight;
@@ -48,7 +45,7 @@ class IfElseModuleInstantiation : public ModuleInstantiation {
public:
IfElseModuleInstantiation() : ModuleInstantiation("if") { }
virtual ~IfElseModuleInstantiation();
- std::vector<AbstractNode*> evaluateElseChildren(const Context *ctx = NULL) const;
+ std::vector<AbstractNode*> evaluateElseChildren(const Context *evalctx) const;
std::vector<ModuleInstantiation*> else_children;
};
@@ -57,7 +54,7 @@ class AbstractModule
{
public:
virtual ~AbstractModule();
- virtual class AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
+ virtual class AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst, const class EvalContext *evalctx = NULL) const;
virtual std::string dump(const std::string &indent, const std::string &name) const;
};
@@ -67,7 +64,10 @@ public:
Module() : is_handling_dependencies(false) { }
virtual ~Module();
- virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
+ void setModulePath(const std::string &path) { this->path = path; }
+ const std::string &modulePath() const { return this->path; }
+
+ virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst, const EvalContext *evalctx) const;
virtual std::string dump(const std::string &indent, const std::string &name) const;
void addChild(ModuleInstantiation *ch) { this->children.push_back(ch); }
@@ -97,6 +97,7 @@ public:
protected:
private:
+ std::string path;
};
#endif
contact: Jan Huwald // Impressum