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

If statement. More...

#include <ast.hh>

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

Public Member Functions

void interpret (Interpreter::Context &c) override
 Interpret the condition, then interpret the body if the condition is true. More...
 
virtual void compile (Compiler::Context &c) override
 Compile the if statement. More...
 
void collectVarUses (std::unordered_set< std::string > &decls, std::unordered_set< std::string > &uses) override
 Collect all of the variables used and defined in this statement. More...
 

Public Attributes

ASTPtr< Expressioncondition
 The condition. More...
 
ASTPtr< Statementsbody
 The body of the if statement. More...
 

Detailed Description

If statement.

Definition at line 747 of file ast.hh.

Member Function Documentation

§ collectVarUses()

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

Collect all of the variables used and defined in this statement.

Implements AST::Statement.

Definition at line 770 of file ast.hh.

§ compile()

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

Compile the if statement.

Reimplemented from AST::Statement.

Definition at line 519 of file compiler.cc.

Here is the call graph for this function:

§ interpret()

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

Interpret the condition, then interpret the body if the condition is true.

Implements AST::Statement.

Definition at line 634 of file interpreter.cc.

Member Data Documentation

§ body

ASTPtr<Statements> AST::IfStatement::body

The body of the if statement.

Definition at line 757 of file ast.hh.

§ condition

ASTPtr<Expression> AST::IfStatement::condition

The condition.

This is interpreted as true if it is either a non-zero integer or a non-null object.

Definition at line 753 of file ast.hh.


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