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


Public Member Functions | |
| virtual bool | compatible_with (const Type &other) const |
| Whether two types are "compatible". | |
| virtual std::ostream & | dump (std::ostream &ostr) const =0 |
| Report this on ostr. | |
Field elementary manipulation. | |
| const Type * | field_type (const misc::symbol key) const |
| Return the type associated to key. | |
| int | field_index (const misc::symbol key) const |
| Return the index of the field associated to key. | |
Accessors. | |
| virtual const Type & | actual () const |
| Return the actual type held by THIS. | |
Protected Attributes | |
| fields_type | fields_ |
| Fields list. | |
Internal Field list manipulators. | |
| typedef std::list< Field > | fields_type |
| List of Field's. | |
| typedef fields_type::const_iterator | const_iterator |
| Iterators over Field's. | |
| const fields_type & | fields_get () const |
| Return the Field list stored in this (read only). | |
| void | field_add (const Field &field) |
| Add an already existing Field to the list. | |
| void | field_add (const misc::symbol name, const Type &type) |
| Create a Field then add it to the list. | |
| const_iterator | begin () const |
| const_iterator | end () const |
| typedef fields_type::const_iterator type::Record::const_iterator |
Iterators over Field's.
| typedef std::list<Field> type::Record::fields_type |
List of Field's.
|
virtualinherited |
Return the actual type held by THIS.
Reimplemented in type::Named.
Referenced by object::TypeChecker::operator()(), and object::DesugarVisitor::recurse_args().
|
inline |
References fields_.
Referenced by 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.
|
pure virtualinherited |
Report this on ostr.
Implemented in type::Named, type::Function, and type::Nil.
|
inline |
References fields_.
Referenced by object::DesugarVisitor::recurse_args().
|
inline |
Add an already existing Field to the list.
References fields_.
Referenced by type::TypeChecker::type().
|
inline |
| int type::Record::field_index | ( | const misc::symbol | key | ) | const |
Return the index of the field associated to key.
The index of a field is its position in the list.
| const Type* type::Record::field_type | ( | const misc::symbol | key | ) | const |
Return the type associated to key.
|
inline |
|
protected |
Fields list.
Referenced by begin(), end(), field_add(), and fields_get().