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

The builtin type of `nil' only (singleton class). More...

#include <builtin-types.hh>

Inheritance diagram for type::Nil:
Collaboration diagram for type::Nil:

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

Static Public Member Functions

static const Nilinstance ()
 Return the unique instance of Nil.

Private Member Functions

 Nil (const Nil &)
Niloperator= (const Nil &)
 Nil ()
 Construct a Nil object (use restricted to internal functions).

Detailed Description

The builtin type of `nil' only (singleton class).

Constructor & Destructor Documentation

type::Nil::Nil ( const Nil )
private
type::Nil::Nil ( )
private

Construct a Nil object (use restricted to internal functions).

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().

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

std::ostream & type::Nil::dump ( std::ostream &  ostr) const
overridevirtual

Print "nil".

Implements type::Type.

const Nil & type::Nil::instance ( )
static
Nil& type::Nil::operator= ( const Nil )
private

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