mirror of https://github.com/vitalif/openscad
access method for parent context
parent
19de4c9d15
commit
d2eecc4e06
|
@ -13,6 +13,7 @@ public:
|
|||
Context(const Context *parent = NULL);
|
||||
virtual ~Context();
|
||||
|
||||
const Context *getParent() const { return this->parent; }
|
||||
virtual Value evaluate_function(const std::string &name, const class EvalContext *evalctx) const;
|
||||
virtual class AbstractNode *instantiate_module(const class ModuleInstantiation &inst, const EvalContext *evalctx) const;
|
||||
|
||||
|
@ -29,11 +30,11 @@ public:
|
|||
std::string getAbsolutePath(const std::string &filename) const;
|
||||
|
||||
public:
|
||||
const Context *parent;
|
||||
|
||||
static std::vector<const Context*> ctx_stack;
|
||||
|
||||
protected:
|
||||
const Context *parent;
|
||||
static std::vector<const Context*> ctx_stack;
|
||||
|
||||
typedef boost::unordered_map<std::string, Value> ValueMap;
|
||||
ValueMap constants;
|
||||
ValueMap variables;
|
||||
|
|
|
@ -109,8 +109,8 @@ const EvalContext* ControlModule::getLastModuleCtx(const EvalContext *evalctx)
|
|||
// Find the last custom module invocation, which will contain
|
||||
// an eval context with the children of the module invokation
|
||||
const Context *tmpc = evalctx;
|
||||
while (tmpc->parent) {
|
||||
const ModuleContext *modulectx = dynamic_cast<const ModuleContext*>(tmpc->parent);
|
||||
while (tmpc->getParent()) {
|
||||
const ModuleContext *modulectx = dynamic_cast<const ModuleContext*>(tmpc->getParent());
|
||||
if (modulectx) {
|
||||
// This will trigger if trying to invoke child from the root of any file
|
||||
// assert(filectx->evalctx);
|
||||
|
@ -119,7 +119,7 @@ const EvalContext* ControlModule::getLastModuleCtx(const EvalContext *evalctx)
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
tmpc = tmpc->parent;
|
||||
tmpc = tmpc->getParent();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue