From 8ee76375d7f19cd0723334e33050584ec83cfe12 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 6 Mar 2009 20:12:35 +0000 Subject: Tidy. git-svn-id: http://svn.drobilla.net/resp/tuplr@61 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- typing.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'typing.cpp') diff --git a/typing.cpp b/typing.cpp index eeba8dc..9dc94f6 100644 --- a/typing.cpp +++ b/typing.cpp @@ -16,6 +16,12 @@ */ #include "tuplr.hpp" + + +/*************************************************************************** + * AST Type Contraints * + ***************************************************************************/ + void ASTTuple::constrain(TEnv& tenv) const { @@ -107,6 +113,11 @@ ASTCdrCall::constrain(TEnv& tenv) const tenv.constrain(this, ct); } + +/*************************************************************************** + * Type Inferencing/Substitution * + ***************************************************************************/ + static void substitute(ASTTuple* tup, AST* from, AST* to) { @@ -118,16 +129,6 @@ substitute(ASTTuple* tup, AST* from, AST* to) substitute(dynamic_cast(tup->at(i)), from, to); } -bool -ASTTuple::contains(AST* child) const -{ - if (*this == *child) return true; - FOREACH(const_iterator, p, *this) - if (**p == *child || (*p)->contains(child)) - return true; - return false; -} - TSubst compose(const TSubst& delta, const TSubst& gamma) // TAPL 22.1.1 { @@ -196,3 +197,4 @@ TEnv::apply(const TSubst& substs) else substitute(t->second, s->first, s->second); } + -- cgit v1.2.1