MysoreScript
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
AST::VarRef Struct Reference

Reference to a variable. More...

#include <ast.hh>

Inheritance diagram for AST::VarRef:
Inheritance graph
[legend]
Collaboration diagram for AST::VarRef:
Collaboration graph
[legend]

Public Member Functions

void collectVarUses (std::unordered_set< std::string > &decls, std::unordered_set< std::string > &uses) override
 Add this variable to the set of referenced variables. More...
 
- Public Member Functions inherited from AST::Expression
virtual bool isConstantExpression ()
 Returns true if the expression is constant and therefore doesn't need interpreting every time. More...
 
Obj evaluate (Interpreter::Context &c)
 Evaluate the expression, caching the result if it's a constant expression. More...
 
void interpret (Interpreter::Context &c) override final
 Interpret this expression as if it were a statement. More...
 
void compile (Compiler::Context &c) override final
 Compile this expression as if it were a statement. More...
 

Public Attributes

ASTChild< Identifiername
 The name of the referenced variable. More...
 

Protected Member Functions

Obj evaluateExpr (Interpreter::Context &c) override
 Evaluate this by looking up the variable in the interpreter's symbol table and loading it. More...
 
llvm::Value * compileExpression (Compiler::Context &c) override
 Compile the reference by looking up the value in the compiler's symbol table and generating code to load it. More...
 

Additional Inherited Members

- Protected Attributes inherited from AST::Expression
Interpreter::Value cache
 Cached result for constant expression. More...
 

Detailed Description

Reference to a variable.

Definition at line 576 of file ast.hh.

Member Function Documentation

§ collectVarUses()

void AST::VarRef::collectVarUses ( std::unordered_set< std::string > &  decls,
std::unordered_set< std::string > &  uses 
)
inlineoverridevirtual

Add this variable to the set of referenced variables.

Implements AST::Statement.

Definition at line 585 of file ast.hh.

§ compileExpression()

Value * VarRef::compileExpression ( Compiler::Context c)
overrideprotectedvirtual

Compile the reference by looking up the value in the compiler's symbol table and generating code to load it.

Implements AST::Expression.

Definition at line 620 of file compiler.cc.

Here is the call graph for this function:

§ evaluateExpr()

Obj VarRef::evaluateExpr ( Interpreter::Context c)
overrideprotectedvirtual

Evaluate this by looking up the variable in the interpreter's symbol table and loading it.

Implements AST::Expression.

Definition at line 450 of file interpreter.cc.

Here is the call graph for this function:

Member Data Documentation

§ name

ASTChild<Identifier> AST::VarRef::name

The name of the referenced variable.

Definition at line 581 of file ast.hh.


The documentation for this struct was generated from the following files: