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

Assignment statements, setting the value of a variable. More...

#include <ast.hh>

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

Public Member Functions

void interpret (Interpreter::Context &c) override
 Interpret the assignment, updating the stored value. More...
 
void compile (Compiler::Context &c) override
 Compile the assignment, looking up the address of the target and storing the result of compiling the expression in it. More...
 
void collectVarUses (std::unordered_set< std::string > &decls, std::unordered_set< std::string > &uses) override
 Collect any variables use in this expression. More...
 

Public Attributes

ASTPtr< VarReftarget
 The variable being assigned to. More...
 
ASTPtr< Expressionexpr
 The expression being assigned. More...
 

Detailed Description

Assignment statements, setting the value of a variable.

Note that MysoreScript does not provide compound-assignment operators.

Definition at line 606 of file ast.hh.

Member Function Documentation

§ collectVarUses()

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

Collect any variables use in this expression.

Implements AST::Statement.

Definition at line 628 of file ast.hh.

§ compile()

void Assignment::compile ( Compiler::Context c)
overridevirtual

Compile the assignment, looking up the address of the target and storing the result of compiling the expression in it.

Reimplemented from AST::Statement.

Definition at line 612 of file compiler.cc.

Here is the call graph for this function:

§ interpret()

void Assignment::interpret ( Interpreter::Context c)
overridevirtual

Interpret the assignment, updating the stored value.

Implements AST::Statement.

Definition at line 660 of file interpreter.cc.

Here is the call graph for this function:

Member Data Documentation

§ expr

ASTPtr<Expression> AST::Assignment::expr

The expression being assigned.

Definition at line 615 of file ast.hh.

§ target

ASTPtr<VarRef> AST::Assignment::target

The variable being assigned to.

Definition at line 611 of file ast.hh.


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