MysoreScript
|
A class declaration. More...
#include <ast.hh>
Public Member Functions | |
void | interpret (Interpreter::Context &c) override |
Interpret, but constructing the class. More... | |
void | collectVarUses (std::unordered_set< std::string > &decls, std::unordered_set< std::string > &uses) override |
Classes are not allowed to be declared inside closures, so there is never a need to collect their declarations. More... | |
Public Member Functions inherited from AST::Statement | |
virtual void | compile (Compiler::Context &c) |
Compile this statement to LLVM IR. More... | |
Public Attributes | |
ASTPtr< Identifier, true > | name |
The name of the class. More... | |
ASTChild< Identifier > | superclassName |
The superclass name (or class name if there is no superclass). More... | |
ASTList< Decl > | ivars |
The instance variables declared in this class. More... | |
ASTList< ClosureDecl > | methods |
The methods declared in this class. More... | |
A class declaration.
Classes contain instance variables and methods.
|
inlineoverridevirtual |
Classes are not allowed to be declared inside closures, so there is never a need to collect their declarations.
Implements AST::Statement.
|
overridevirtual |
Interpret, but constructing the class.
Note that there is no compile method for classes. They are always interpreted, although their methods may be compiled.
Implements AST::Statement.
Definition at line 698 of file interpreter.cc.
ASTList<Decl> AST::ClassDecl::ivars |
ASTList<ClosureDecl> AST::ClassDecl::methods |
ASTPtr<Identifier, true> AST::ClassDecl::name |
The name of the class.
AST construction happens depth-first, so this is optional even though it is really the superclass name that is optional. If a superclass is not specified, then the class name is in the superclassName
field. This is because the first identifier will be popped off the AST stack when constructing superclassName
, even if it were marked as optional, because the two identifiers can't be distinguished.
ASTChild<Identifier> AST::ClassDecl::superclassName |