LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
|
Abstract a type. More...
#include <type.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. | |
Ctor & dtor. | |
virtual | ~Type () |
Destroys a Type. | |
Accessors. | |
virtual const Type & | actual () const |
Return the actual type held by THIS. |
Abstract a type.
|
virtual |
Destroys a Type.
|
virtual |
Return the actual type held by THIS.
Reimplemented in type::Named.
Referenced by object::TypeChecker::operator()(), and object::DesugarVisitor::recurse_args().
|
virtual |
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 virtual |
Report this on ostr.
Implemented in type::Named, type::Function, and type::Nil.