LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
|
Cast the type of an expression to a given type. More...
#include <cast-exp.hh>
Public Member Functions | |
Ctor & dtor. | |
CastExp (const Location &location, Exp *exp, Ty *ty) | |
Construct a CastExp node. | |
virtual | ~CastExp () |
Destroy a CastExp node. | |
Visitors entry point. | |
virtual void | accept (ConstVisitor &v) const override |
Accept a const visitor v. | |
virtual void | accept (Visitor &v) override |
Accept a non-const visitor v. | |
Accessors. | |
const Exp & | exp_get () const |
Return the cast expression. | |
Exp & | exp_get () |
Return the cast expression. | |
const Ty & | ty_get () const |
Return the target type. | |
Ty & | ty_get () |
Return the target type. | |
Accessors. | |
const Location & | location_get () const |
Return scanner position information. | |
void | location_set (const Location &) |
Set scanner position information. |
Protected Attributes | |
Exp * | exp_ |
The cast expression. | |
Ty * | ty_ |
The target type. | |
Location | location_ |
Scanner position information. |
Cast the type of an expression to a given type.
This node is only used in the bound checking transformation (see desugar::bound_checks_add). You don't need to worry about it (nor about the `cast' keyword) if you don't implement this option.
|
overridevirtual |
Accept a const visitor v.
Implements ast::Exp.
|
overridevirtual |
Accept a non-const visitor v.
Implements ast::Exp.
|
inline |
Return the cast expression.
References exp_.
Referenced by ast::PrettyPrinter::operator()(), and astclone::Cloner::operator()().
|
inlineinherited |
Return scanner position information.
References ast::Ast::location_.
Referenced by type::TypeChecker::error(), object::DesugarVisitor::operator()(), astclone::Cloner::operator()(), ast::DecsList::push_back(), ast::DecsList::push_front(), and type::TypeChecker::type_mismatch().
|
inlineinherited |
Set scanner position information.
References ast::Ast::location_.
|
inline |
Return the target type.
References ty_.
Referenced by ast::PrettyPrinter::operator()(), and astclone::Cloner::operator()().
|
protected |
The cast expression.
Referenced by exp_get(), and ~CastExp().
|
protectedinherited |
Scanner position information.
Referenced by ast::Ast::location_get(), ast::Ast::location_set(), ast::DecsList::push_back(), and ast::DecsList::push_front().
|
protected |
The target type.
Referenced by ty_get(), and ~CastExp().