LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
type::Record Class Reference

Record types. More...

#include <record.hh>

Inheritance diagram for type::Record:
Collaboration diagram for type::Record:

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 Typefield_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 Typeactual () const
 Return the actual type held by THIS.

Protected Attributes

fields_type fields_
 Fields list.

Internal Field list manipulators.

typedef std::list< Fieldfields_type
 List of Field's.
typedef fields_type::const_iterator const_iterator
 Iterators over Field's.
const fields_typefields_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

Detailed Description

Record types.

List of Field s.

Member Typedef Documentation

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.

Member Function Documentation

const Type & type::Type::actual ( ) const
virtualinherited

Return the actual type held by THIS.

Reimplemented in type::Named.

Referenced by object::TypeChecker::operator()(), and object::DesugarVisitor::recurse_args().

Record::const_iterator type::Record::begin ( ) const
inline

References fields_.

Referenced by object::DesugarVisitor::recurse_args().

bool type::Type::compatible_with ( const Type other) const
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.

virtual std::ostream& type::Type::dump ( std::ostream &  ostr) const
pure virtualinherited

Report this on ostr.

Implemented in type::Named, type::Function, and type::Nil.

Record::const_iterator type::Record::end ( ) const
inline

References fields_.

Referenced by object::DesugarVisitor::recurse_args().

void type::Record::field_add ( const Field field)
inline

Add an already existing Field to the list.

References fields_.

Referenced by type::TypeChecker::type().

void type::Record::field_add ( const misc::symbol  name,
const Type type 
)
inline

Create a Field then add it to the list.

References fields_.

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.

const Record::fields_type & type::Record::fields_get ( ) const
inline

Return the Field list stored in this (read only).

References fields_.

Member Data Documentation

fields_type type::Record::fields_
protected

Fields list.

Referenced by begin(), end(), field_add(), and fields_get().


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