tipc
A TIP to LLVM compiler
|
Produces a type with designated variable substitutions. More...
#include <Substituter.h>
Public Member Functions | |
Substituter (TipVar *t, std::shared_ptr< TipType > s) | |
std::shared_ptr< TipType > | getResult () |
virtual void | endVisit (TipAlpha *element) override |
virtual void | endVisit (TipFunction *element) override |
virtual void | endVisit (TipInt *element) override |
virtual void | endVisit (TipMu *element) override |
virtual void | endVisit (TipRecord *element) override |
virtual void | endVisit (TipAbsentField *element) override |
virtual void | endVisit (TipRef *element) override |
virtual void | endVisit (TipVar *element) override |
Substitute if variable is the target. More... | |
![]() | |
virtual bool | visit (TipAlpha *element) |
virtual bool | visit (TipFunction *element) |
virtual bool | visit (TipInt *element) |
virtual bool | visit (TipMu *element) |
virtual bool | visit (TipRecord *element) |
virtual bool | visit (TipAbsentField *element) |
virtual bool | visit (TipRef *element) |
virtual bool | visit (TipVar *element) |
Static Public Member Functions | |
static std::shared_ptr< TipType > | substitute (TipType *t, TipVar *v, std::shared_ptr< TipType > s) |
Substitute for instances of variable in a target type. More... | |
Protected Member Functions | |
Substituter ()=default | |
Protected Attributes | |
std::vector< std::shared_ptr< TipType > > | visitedTypes |
Produces a type with designated variable substitutions.
|
protecteddefault |
|
overridevirtual |
Reimplemented from TipTypeVisitor.
|
overridevirtual |
Reimplemented from TipTypeVisitor.
Reimplemented in FreshAlphaCopier, and Copier.
|
overridevirtual |
Reimplemented from TipTypeVisitor.
|
overridevirtual |
Reimplemented from TipTypeVisitor.
|
overridevirtual |
Reimplemented from TipTypeVisitor.
|
overridevirtual |
Reimplemented from TipTypeVisitor.
|
overridevirtual |
Reimplemented from TipTypeVisitor.
|
overridevirtual |
std::shared_ptr< TipType > Substituter::getResult | ( | ) |
|
static |
Substitute for instances of variable in a target type.
This function requires the substitution to be a shared_ptr so that it can be directly substituted for the variable without having to be reconstructed. This simplifies things when the substitution is a complex type expression. It does lead to a bit of asymmetry in the API and it will lead to sharing among type expressions, which is why we use shared_ptrs.
t | The type on which substitution is performed. |
v | The target variable. |
s | The subtitution. |
|
protected |