LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
|
The builtin type of `nil' only (singleton class). More...
#include <builtin-types.hh>
Public Member Functions | |
virtual bool | compatible_with (const Type &other) const override |
Whether two types are "compatible". | |
virtual std::ostream & | dump (std::ostream &ostr) const override |
Print "nil". | |
Accessors. | |
virtual const Type & | actual () const |
Return the actual type held by THIS. |
Static Public Member Functions | |
static const Nil & | instance () |
Return the unique instance of Nil. |
Private Member Functions | |
Nil (const Nil &) | |
Nil & | operator= (const Nil &) |
Nil () | |
Construct a Nil object (use restricted to internal functions). |
The builtin type of `nil' only (singleton class).
|
private |
|
private |
Construct a Nil object (use restricted to internal functions).
|
virtualinherited |
Return the actual type held by THIS.
Reimplemented in type::Named.
Referenced by object::TypeChecker::operator()(), and object::DesugarVisitor::recurse_args().
|
overridevirtual |
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 from type::Type.
|
overridevirtual |
Print "nil".
Implements type::Type.
|
static |
Return the unique instance of Nil.
Referenced by object::DesugarVisitor::operator()(), type::TypeChecker::operator()(), and object::DesugarVisitor::recurse_args().