Zen
A cross-platform functional programming language
|
Class that collects external references from different AST nodes. More...
#include <GetXRef.hpp>
Classes | |
struct | DefStackItem |
Wrapper around a stack item. More... | |
struct | StackItem |
Class maintains a stack item of scopes. More... | |
Public Member Functions | |
RefCollector (ParseContext &pctx, const Ast::Storage::T &storage) | |
Default constructor. | |
~RefCollector () | |
Destructor. | |
void | getInvokerRefList (const Ast::Invoker &invoker) |
Get the list of external references for an invoker. | |
void | getImplItemRefList (const Ast::ImplItem &item) |
Get the list of external references for an item. | |
void | getExprRefList (const Ast::Expr &expr) |
Get the list of external references for an expression. | |
void | getExprListRefList (const Ast::ExprList &list) |
Get the list of external references for an expression list. | |
void | getSharedDefRefList (const Ast::SharedDef &sdef) |
Get the list of external references for a shared definition. | |
void | getStatementListRefList (const Ast::FunctionDef &fdef, const Ast::StatementList &list) |
Get the list of external references for a statement list. | |
const Ast::VariableRefList & | getRefList () const |
Get the list of external references that has been collected. | |
void | addDef (const Ast::VariableDef &def) |
Add a variable definition to the top item on the stack. | |
bool | hasDefItem (const Ast::VariableDef &vdef) |
Check if a variable definition is present anywhere in the stack. | |
void | setStorage (const Ast::VariableRef &vref, const Ast::Storage::T &storage) |
Set the staorage type for a variable definition. | |
bool | addRef (const Ast::VariableRef &vref) |
Add a variable reference to the collection list. | |
void | addRefWithStorage (const Ast::VariableRef &vref) |
Add a variable reference to the collection list and set the storage. | |
void | addRefList (const Ast::VariableRefList &xRefList) |
Add a variable reference list to the collection list. | |
Private Types | |
typedef z::stack< StackItem * > | DefStack |
The stack of scopes using StackItem. | |
Private Member Functions | |
RefCollector (const RefCollector &src) | |
Copy constructor. | |
z::string | printStack () const |
Print the current stack for debugging. | |
StackItem & | pushDefItem (const Ast::Scope::Type &type) |
Push a new scope on the stack. | |
void | popDefItem (StackItem &item) |
Pop a scope off the stack. | |
Private Attributes | |
ParseContext & | _pctx |
The parse context. | |
const Ast::Storage::T | _storage |
The storage type to set for external references. | |
Ast::VariableRefList | _refList |
The list of external references. | |
DefStack | _defStack |
The definition stack. |
Class that collects external references from different AST nodes.
RefCollector | ( | ParseContext & | pctx, |
const Ast::Storage::T & | storage | ||
) | [inline] |
Default constructor.
pctx | The collector context |
storage | The storage type to set for external references collected |
RefCollector | ( | const RefCollector & | src | ) | [inline, private] |
Copy constructor.
This is private to prevent copy construction
src | The source instance |
void addDef | ( | const Ast::VariableDef & | def | ) | [inline] |
Add a variable definition to the top item on the stack.
def | The variable definition to add |
bool addRef | ( | const Ast::VariableRef & | vref | ) | [inline] |
Add a variable reference to the collection list.
vref | The variable reference to add |
void addRefList | ( | const Ast::VariableRefList & | xRefList | ) | [inline] |
Add a variable reference list to the collection list.
xRefList | The variable reference to merge |
void addRefWithStorage | ( | const Ast::VariableRef & | vref | ) | [inline] |
Add a variable reference to the collection list and set the storage.
vref | The variable reference to add |
void getExprListRefList | ( | const Ast::ExprList & | list | ) |
Get the list of external references for an expression list.
list | The expression list to visit |
void getExprRefList | ( | const Ast::Expr & | expr | ) |
Get the list of external references for an expression.
expr | The expression to visit |
void getImplItemRefList | ( | const Ast::ImplItem & | item | ) |
Get the list of external references for an item.
item | The item to visit |
void getInvokerRefList | ( | const Ast::Invoker & | invoker | ) |
Get the list of external references for an invoker.
invoker | The invoker to visit |
const Ast::VariableRefList& getRefList | ( | ) | const [inline] |
Get the list of external references that has been collected.
void getSharedDefRefList | ( | const Ast::SharedDef & | sdef | ) |
Get the list of external references for a shared definition.
sdef | The shared definition to visit |
void getStatementListRefList | ( | const Ast::FunctionDef & | fdef, |
const Ast::StatementList & | list | ||
) |
Get the list of external references for a statement list.
fdef | The function definition whose in-params are to be added to the list |
list | The statement list to visit |
bool hasDefItem | ( | const Ast::VariableDef & | vdef | ) | [inline] |
Check if a variable definition is present anywhere in the stack.
vdef | The variable definition to check |
void popDefItem | ( | StackItem & | item | ) | [inline, private] |
Pop a scope off the stack.
item | The item to pop |
z::string printStack | ( | ) | const [inline, private] |
Print the current stack for debugging.
StackItem& pushDefItem | ( | const Ast::Scope::Type & | type | ) | [inline, private] |
Push a new scope on the stack.
type | The type of the new scope to push on the stack |
void setStorage | ( | const Ast::VariableRef & | vref, |
const Ast::Storage::T & | storage | ||
) | [inline] |
Set the staorage type for a variable definition.
vref | The variable reference to alter |
storage | The storage type to set |