|
nixd
|
#include <VariableLookup.h>
Classes | |
| struct | LookupResult |
Public Types | |
| enum class | LookupResultKind { Undefined , FromWith , Defined , NoSuchVar } |
| using | ToDefMap = std::map<const Node *, std::shared_ptr<Definition>> |
| using | EnvMap = std::map<const Node *, std::shared_ptr<EnvNode>> |
Public Member Functions | |
| VariableLookupAnalysis (std::vector< Diagnostic > &Diags) | |
| void | runOnAST (const Node &Root) |
| Perform variable lookup analysis (def-use) on AST. | |
| LookupResult | query (const ExprVar &Var) const |
| Query the which name/with binds to specific varaible. | |
| const Definition * | toDef (const Node &N) const |
| Get definition record for some name. | |
| const EnvNode * | env (const Node *N) const |
Definition at line 112 of file VariableLookup.h.
| using nixf::VariableLookupAnalysis::EnvMap = std::map<const Node *, std::shared_ptr<EnvNode>> |
Definition at line 127 of file VariableLookup.h.
| using nixf::VariableLookupAnalysis::ToDefMap = std::map<const Node *, std::shared_ptr<Definition>> |
Definition at line 126 of file VariableLookup.h.
|
strong |
| Enumerator | |
|---|---|
| Undefined | |
| FromWith | |
| Defined | |
| NoSuchVar | |
Definition at line 114 of file VariableLookup.h.
| VariableLookupAnalysis::VariableLookupAnalysis | ( | std::vector< Diagnostic > & | Diags | ) |
Definition at line 478 of file VariableLookup.cpp.
Definition at line 481 of file VariableLookup.cpp.
Referenced by nixd::upEnv().
|
inlinenodiscard |
Query the which name/with binds to specific varaible.
Definition at line 176 of file VariableLookup.h.
References NoSuchVar.
Referenced by nixd::idioms::mkVarSelector().
| void VariableLookupAnalysis::runOnAST | ( | const Node & | Root | ) |
Perform variable lookup analysis (def-use) on AST.
Definition at line 455 of file VariableLookup.cpp.
References nixf::PrimOpsInfo.
Referenced by main().
|
inlinenodiscard |
Get definition record for some name.
For some cases, we need to get "definition" record to find all references to this definition, on AST.
Thus we need to store AST -> Definition There are many pointers on AST, the convention is:
"with" keyword is recorded.
Definition at line 194 of file VariableLookup.h.