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

A variable declaration. More...

#include <ast.hh>

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

Public Member Functions

void interpret (Interpreter::Context &c) override
 Sets the variable to the value in the initialisation. More...
 
void compile (Compiler::Context &c) override
 Compiles the initialiser, if one exists. More...
 
void collectVarUses (std::unordered_set< std::string > &decls, std::unordered_set< std::string > &uses) override
 Adds this variable to the set that are defined. More...
 

Public Attributes

ASTChild< Identifiername
 The name of the variable. More...
 
ASTPtr< Expression, true > init
 The initialiser for this variable, if there is one. More...
 

Detailed Description

A variable declaration.

Definition at line 690 of file ast.hh.

Member Function Documentation

§ collectVarUses()

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

Adds this variable to the set that are defined.

Implements AST::Statement.

Definition at line 711 of file ast.hh.

§ compile()

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

Compiles the initialiser, if one exists.

Reimplemented from AST::Statement.

Definition at line 601 of file compiler.cc.

Here is the call graph for this function:

§ interpret()

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

Sets the variable to the value in the initialisation.

Implements AST::Statement.

Definition at line 648 of file interpreter.cc.

Here is the call graph for this function:

Member Data Documentation

§ init

ASTPtr<Expression, true> AST::Decl::init

The initialiser for this variable, if there is one.

Definition at line 699 of file ast.hh.

§ name

ASTChild<Identifier> AST::Decl::name

The name of the variable.

Definition at line 695 of file ast.hh.


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