|
LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
|
#include <method.hh>


Public Member Functions | |
| Method (const misc::symbol &name, const Class *owner, const Record *formals, const Type &result, ast::MethodDec *def) | |
| Construct a FunEntry. | |
| virtual | ~Method () |
| Destructor. | |
| virtual std::ostream & | dump (std::ostream &ostr) const override |
| Print function's result's and formals's types. | |
| virtual bool | compatible_with (const Type &other) const |
| Whether two types are "compatible". | |
Accessors. | |
| misc::symbol | name_get () const |
| Return the method's name. | |
| const Class * | owner_get () const |
| Return thes method's owner (enclosing class). | |
| const ast::MethodDec * | def_get () const |
| Return the method's definiton site. | |
| ast::MethodDec * | def_get () |
| Return the method's definiton site. | |
| void | name_set (const misc::symbol &name) |
| Set the method's name. | |
| void | def_set (ast::MethodDec *def) |
| set the method's definiton site. | |
Accessors. | |
| const Record & | formals_get () const |
| Return the type structures of the function's arguments. | |
| const Type & | result_get () const |
| Return the type structure of the function's result. | |
Accessors. | |
| virtual const Type & | actual () const |
| Return the actual type held by THIS. | |
Protected Attributes | |
| const Record * | formals_ |
| Formals' types. | |
| const Type & | result_ |
| Result's type. | |
Private Types | |
| typedef Function | super_type |
| A shortcut for the super type of this class. | |
Private Attributes | |
| misc::symbol | name_ |
| Method's identifier. | |
| const Class * | owner_ |
| The Class where this Method is defined. | |
| ast::MethodDec * | def_ |
| Method's definition site. | |
Method types.
Encapsulate the signature of a method, ie the type structures of both method's arguments and its result.
|
private |
A shortcut for the super type of this class.
| type::Method::Method | ( | const misc::symbol & | name, |
| const Class * | owner, | ||
| const Record * | formals, | ||
| const Type & | result, | ||
| ast::MethodDec * | def | ||
| ) |
Construct a FunEntry.
| name | The method's identifier. |
| owner | The type::Class owning this method. |
| formals | The type structures of formal arguments. |
| result | The type structure of what method returns. |
| def | The method's definition site. |
|
virtual |
Destructor.
|
virtualinherited |
Return the actual type held by THIS.
Reimplemented in type::Named.
Referenced by object::TypeChecker::operator()(), and object::DesugarVisitor::recurse_args().
|
virtualinherited |
Whether two types are "compatible".
I.e., whether "a = b", "a <> b", "a := b" are correctly typed with a of type this, and b of type other).
By default two types are compatible (in the sense of "=" and "<>", not wrt an order) only when they are equal.
In the case of assignment, "rec := nil" is valid, but "nil := rec" is not, which suggest that we should have a non commutative assignment specific compatibility check. But since "nil := ..." is incorrect syntactically, that is not needed.
Reimplemented in type::Named, and type::Nil.
|
inline |
Return the method's definiton site.
References def_.
Referenced by object::DesugarVisitor::dispatch_switch().
|
inline |
Return the method's definiton site.
References def_.
|
inline |
set the method's definiton site.
References def_.
|
overridevirtualinherited |
Print function's result's and formals's types.
Implements type::Type.
References type::Function::formals_, type::hide_actual_types, type::Function::result_, and misc::xalloc< StoredType >::swap().
|
inlineinherited |
Return the type structures of the function's arguments.
References type::Function::formals_.
|
inline |
Return the method's name.
References name_.
Referenced by object::DesugarVisitor::dispatch_fun_name(), and object::DesugarVisitor::dispatch_switch().
|
inline |
Set the method's name.
References name_.
|
inline |
Return thes method's owner (enclosing class).
References owner_.
|
inlineinherited |
Return the type structure of the function's result.
References type::Function::result_.
|
private |
|
protectedinherited |
Formals' types.
Referenced by type::Function::dump(), type::Function::formals_get(), type::Function::Function(), and type::Function::~Function().
|
private |
Method's identifier.
Referenced by name_get(), and name_set().
|
private |
The Class where this Method is defined.
Referenced by owner_get().
|
protectedinherited |
Result's type.
Referenced by type::Function::dump(), and type::Function::result_get().