21 return iter->second.get();
43 return iter->second.get();
57 iter->second = prototype;
59 _functions.insert(std::make_pair(name, prototype));
69 iter->second = std::move(var);
71 _map.insert(std::make_pair(name, std::move(var)));
76 using MakeMap = std::map<std::pair<ExprLocalVar *, ExprLocalVar *>, std::string>;
80 const std::string &name =
ienv.first;
88 const std::string &name =
ienv.first;
97 auto newVar = std::make_unique<ExprLocalVarPhi>(type,
it.first.first,
it.first.second);
Node that contains local function.
ExprLocalVar join (merge) references. Remembers which variables are possible assigners to this.
ExprLocalVar reference, all local variables in seexpr are subclasses of this or this itself.
Variable scope for tracking variable lookup.
ExprLocalVar * find(const std::string &name)
Find a variable name by name (recursive to parents)
ExprLocalVar const * lookup(const std::string &name) const
Find a const variable reference name by name (recursive to parents)
ExprLocalFunctionNode * findFunction(const std::string &name)
Find a function by name (recursive to parents)
void addFunction(const std::string &name, ExprLocalFunctionNode *prototype)
Add a function.
std::vector< std::vector< std::pair< std::string, ExprLocalVarPhi * > > > _mergedVariables
Keep track of all merged variables in.
void add(const std::string &name, std::unique_ptr< ExprLocalVar > var)
Add a variable refernece.
std::vector< std::unique_ptr< ExprLocalVar > > shadowedVariables
Variables that have been superceded (and thus are inaccessible)
ExprVarEnv * _parent
Parent variable environment has all variablesf rom previou scope (for lookup)
void resetAndSetParent(ExprVarEnv *parent)
Resets the scope (deletes all variables) and sets parent.
size_t mergeBranches(const ExprType &type, ExprVarEnv &env1, ExprVarEnv &env2)
Add all variables into scope by name, but modify their lifetimes to the given type's lifetime.