Changeset 8c49c0e
- Timestamp:
- Sep 19, 2016, 4:39:33 PM (6 years ago)
- Branches:
- aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- aefcc3b
- Parents:
- 3c13c03
- Location:
- src
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
r3c13c03 r8c49c0e 110 110 void addInferredParams( ApplicationExpr *appExpr, FunctionType *functionType, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars ); 111 111 /// Stores assignment operators from assertion list in local map of assignment operations 112 void findTypeOps( const std::list< TypeDecl *>&forall );112 void findTypeOps( const Type::ForallList &forall ); 113 113 void passAdapters( ApplicationExpr *appExpr, FunctionType *functionType, const TyVarMap &exprTyVars ); 114 114 FunctionDecl *makeAdapter( FunctionType *adaptee, FunctionType *realType, const std::string &mangleName, const TyVarMap &tyVars ); … … 612 612 } 613 613 614 void Pass1::findTypeOps( const std::list< TypeDecl *>&forall ) {614 void Pass1::findTypeOps( const Type::ForallList &forall ) { 615 615 // what if a nested function uses an assignment operator? 616 616 // assignOps.clear(); 617 for ( std::list< TypeDecl *>::const_iterator i = forall.begin(); i != forall.end(); ++i ) {617 for ( Type::ForallList::const_iterator i = forall.begin(); i != forall.end(); ++i ) { 618 618 for ( std::list< DeclarationWithType *>::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) { 619 619 std::string typeName; … … 680 680 std::list< DeclarationWithType *> ¶mList = functionType->get_parameters(); 681 681 std::list< FunctionType *> functions; 682 for ( std::list< TypeDecl *>::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {682 for ( Type::ForallList::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) { 683 683 for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) { 684 684 findFunction( (*assert)->get_type(), functions, scopeTyVars, needsAdapter ); … … 946 946 void Pass1::addInferredParams( ApplicationExpr *appExpr, FunctionType *functionType, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars ) { 947 947 std::list< Expression *>::iterator cur = arg; 948 for ( std::list< TypeDecl *>::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {948 for ( Type::ForallList::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) { 949 949 for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) { 950 950 InferredParams::const_iterator inferParam = appExpr->get_inferParams().find( (*assert)->get_uniqueId() ); … … 1013 1013 Statement *bodyStmt; 1014 1014 1015 std::list< TypeDecl *>::iterator tyArg = realType->get_forall().begin();1016 std::list< TypeDecl *>::iterator tyParam = adapterType->get_forall().begin();1017 std::list< TypeDecl *>::iterator realTyParam = adaptee->get_forall().begin();1015 Type::ForallList::iterator tyArg = realType->get_forall().begin(); 1016 Type::ForallList::iterator tyParam = adapterType->get_forall().begin(); 1017 Type::ForallList::iterator realTyParam = adaptee->get_forall().begin(); 1018 1018 for ( ; tyParam != adapterType->get_forall().end(); ++tyArg, ++tyParam, ++realTyParam ) { 1019 1019 assert( tyArg != realType->get_forall().end() ); … … 1064 1064 std::list< DeclarationWithType *> ¶mList = functionType->get_parameters(); 1065 1065 std::list< FunctionType *> functions; 1066 for ( std::list< TypeDecl *>::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {1066 for ( Type::ForallList::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) { 1067 1067 for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) { 1068 1068 findFunction( (*assert)->get_type(), functions, exprTyVars, needsAdapter ); … … 1416 1416 // find each of its needed secondary assignment operators 1417 1417 std::list< Expression* > &tyParams = refType->get_parameters(); 1418 std::list< TypeDecl* >&forallParams = functionDecl->get_type()->get_forall();1418 Type::ForallList &forallParams = functionDecl->get_type()->get_forall(); 1419 1419 std::list< Expression* >::const_iterator tyIt = tyParams.begin(); 1420 std::list< TypeDecl* >::const_iterator forallIt = forallParams.begin();1420 Type::ForallList::const_iterator forallIt = forallParams.begin(); 1421 1421 for ( ; tyIt != tyParams.end() && forallIt != forallParams.end(); ++tyIt, ++forallIt ) { 1422 1422 // Add appropriate mapping to assignment expression environment … … 1592 1592 ObjectDecl newPtr( "", DeclarationNode::NoStorageClass, LinkageSpec::C, 0, 1593 1593 new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ), 0 ); 1594 for ( std::list< TypeDecl *>::const_iterator tyParm = funcType->get_forall().begin(); tyParm != funcType->get_forall().end(); ++tyParm ) {1594 for ( Type::ForallList::const_iterator tyParm = funcType->get_forall().begin(); tyParm != funcType->get_forall().end(); ++tyParm ) { 1595 1595 ObjectDecl *sizeParm, *alignParm; 1596 1596 // add all size and alignment parameters to parameter list -
src/GenPoly/CopyParams.cc
r3c13c03 r8c49c0e 54 54 std::map< std::string, DeclarationWithType* > assignOps; 55 55 // assume the assignment operator is the first assert param after any "type" parameter 56 for ( std::list< TypeDecl* >::const_iterator tyVar = funcDecl->get_functionType()->get_forall().begin(); tyVar != funcDecl->get_functionType()->get_forall().end(); ++tyVar ) {56 for ( Type::ForallList::const_iterator tyVar = funcDecl->get_functionType()->get_forall().begin(); tyVar != funcDecl->get_functionType()->get_forall().end(); ++tyVar ) { 57 57 if ( (*tyVar)->get_kind() == TypeDecl::Any ) { 58 58 assert( !(*tyVar)->get_assertions().empty() ); -
src/GenPoly/FindFunction.cc
r3c13c03 r8c49c0e 29 29 virtual Type *mutate( PointerType *pointerType ); 30 30 private: 31 void handleForall( const std::list< TypeDecl* >&forall );31 void handleForall( const Type::ForallList &forall ); 32 32 33 33 std::list< FunctionType* > &functions; … … 51 51 } 52 52 53 void FindFunction::handleForall( const std::list< TypeDecl* >&forall ) {54 for ( std::list< TypeDecl* >::const_iterator i = forall.begin(); i != forall.end(); ++i ) {53 void FindFunction::handleForall( const Type::ForallList &forall ) { 54 for ( Type::ForallList::const_iterator i = forall.begin(); i != forall.end(); ++i ) { 55 55 TyVarMap::iterator var = tyVars.find( (*i)->get_name() ); 56 56 if ( var != tyVars.end() ) { -
src/GenPoly/GenPoly.cc
r3c13c03 r8c49c0e 110 110 ReferenceToType *isDynRet( FunctionType *function, const TyVarMap &forallTypes ) { 111 111 if ( function->get_returnVals().empty() ) return 0; 112 112 113 113 return (ReferenceToType*)isDynType( function->get_returnVals().front()->get_type(), forallTypes ); 114 114 } … … 127 127 // } // if 128 128 if ( isDynRet( adaptee, tyVars ) ) return true; 129 129 130 130 for ( std::list< DeclarationWithType* >::const_iterator innerArg = adaptee->get_parameters().begin(); innerArg != adaptee->get_parameters().end(); ++innerArg ) { 131 131 // if ( isPolyType( (*innerArg)->get_type(), tyVars ) ) { … … 228 228 229 229 void makeTyVarMap( Type *type, TyVarMap &tyVarMap ) { 230 for ( std::list< TypeDecl* >::const_iterator tyVar = type->get_forall().begin(); tyVar != type->get_forall().end(); ++tyVar ) {230 for ( Type::ForallList::const_iterator tyVar = type->get_forall().begin(); tyVar != type->get_forall().end(); ++tyVar ) { 231 231 assert( *tyVar ); 232 232 tyVarMap[ (*tyVar)->get_name() ] = (*tyVar)->get_kind(); -
src/InitTweak/GenInit.cc
r3c13c03 r8c49c0e 288 288 managedTypes.beginScope(); 289 289 // go through assertions and recursively add seen ctor/dtors 290 for ( TypeDecl *tyDecl : functionDecl->get_functionType()->get_forall() ) {290 for ( auto & tyDecl : functionDecl->get_functionType()->get_forall() ) { 291 291 for ( DeclarationWithType *& assertion : tyDecl->get_assertions() ) { 292 292 assertion = assertion->acceptMutator( *this ); -
src/Parser/TypeData.cc
r3c13c03 r8c49c0e 428 428 } // TypeData::print 429 429 430 void buildForall( const DeclarationNode * firstNode, std::list< TypeDecl* > &outputList ) { 430 template< typename ForallList > 431 void buildForall( const DeclarationNode * firstNode, ForallList &outputList ) { 431 432 buildList( firstNode, outputList ); 432 for ( std::list< TypeDecl* >::iterator i = outputList.begin(); i != outputList.end(); ++i ) { 433 if ( (*i)->get_kind() == TypeDecl::Any ) { 433 for ( typename ForallList::iterator i = outputList.begin(); i != outputList.end(); ++i ) { 434 TypeDecl * td = static_cast<TypeDecl*>(*i); 435 if ( td->get_kind() == TypeDecl::Any ) { 434 436 // add assertion parameters to `type' tyvars in reverse order 435 437 // add dtor: void ^?{}(T *) 436 438 FunctionType * dtorType = new FunctionType( Type::Qualifiers(), false ); 437 dtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i) ), 0 ) );438 (*i)->get_assertions().push_front( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, dtorType, 0, false, false ) );439 dtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), td ) ), 0 ) ); 440 td->get_assertions().push_front( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, dtorType, 0, false, false ) ); 439 441 440 442 // add copy ctor: void ?{}(T *, T) 441 443 FunctionType * copyCtorType = new FunctionType( Type::Qualifiers(), false ); 442 copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i) ), 0 ) );443 copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i), 0 ) );444 (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, copyCtorType, 0, false, false ) );444 copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), td ) ), 0 ) ); 445 copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), td->get_name(), td ), 0 ) ); 446 td->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, copyCtorType, 0, false, false ) ); 445 447 446 448 // add default ctor: void ?{}(T *) 447 449 FunctionType * ctorType = new FunctionType( Type::Qualifiers(), false ); 448 ctorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i) ), 0 ) );449 (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, ctorType, 0, false, false ) );450 ctorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), td ) ), 0 ) ); 451 td->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, ctorType, 0, false, false ) ); 450 452 451 453 // add assignment operator: T * ?=?(T *, T) 452 454 FunctionType * assignType = new FunctionType( Type::Qualifiers(), false ); 453 assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i) ), 0 ) );454 assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i), 0 ) );455 assignType->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i), 0 ) );456 (*i)->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, assignType, 0, false, false ) );455 assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), td ) ), 0 ) ); 456 assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), td->get_name(), td ), 0 ) ); 457 assignType->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), td->get_name(), td ), 0 ) ); 458 td->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, assignType, 0, false, false ) ); 457 459 } // if 458 460 } // for … … 562 564 // character types. The implementation shall define char to have the same range, representation, and behavior as 563 565 // either signed char or unsigned char. 564 static BasicType::Kind chartype[] = { BasicType::SignedChar, BasicType::UnsignedChar, BasicType::Char }; 566 static BasicType::Kind chartype[] = { BasicType::SignedChar, BasicType::UnsignedChar, BasicType::Char }; 565 567 566 568 if ( td->length != DeclarationNode::NoLength ) { -
src/ResolvExpr/AlternativeFinder.cc
r3c13c03 r8c49c0e 362 362 /// Adds type variables to the open variable set and marks their assertions 363 363 void makeUnifiableVars( Type *type, OpenVarSet &unifiableVars, AssertionSet &needAssertions ) { 364 for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {364 for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) { 365 365 unifiableVars[ (*tyvar)->get_name() ] = (*tyvar)->get_kind(); 366 366 for ( std::list< DeclarationWithType* >::iterator assert = (*tyvar)->get_assertions().begin(); assert != (*tyvar)->get_assertions().end(); ++assert ) { -
src/ResolvExpr/FindOpenVars.cc
r3c13c03 r8c49c0e 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // FindOpenVars.cc -- 7 // FindOpenVars.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 47 47 void FindOpenVars::common_action( Type *type ) { 48 48 if ( nextIsOpen ) { 49 for ( std::list< TypeDecl* >::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {49 for ( Type::ForallList::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) { 50 50 openVars[ (*i)->get_name() ] = (*i)->get_kind(); 51 51 for ( std::list< DeclarationWithType* >::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) { … … 56 56 } 57 57 } else { 58 for ( std::list< TypeDecl* >::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {58 for ( Type::ForallList::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) { 59 59 closedVars[ (*i)->get_name() ] = (*i)->get_kind(); 60 60 for ( std::list< DeclarationWithType* >::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) { -
src/ResolvExpr/RenameVars.cc
r3c13c03 r8c49c0e 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // RenameVars.cc -- 7 // RenameVars.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 115 115 mapStack.push_front( mapStack.front() ); 116 116 // renames all "forall" type names to `_${level}_${name}' 117 for ( std::list< TypeDecl* >::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {117 for ( Type::ForallList::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) { 118 118 std::ostringstream output; 119 119 output << "_" << level << "_" << (*i)->get_name(); -
src/ResolvExpr/TypeEnvironment.cc
r3c13c03 r8c49c0e 158 158 } 159 159 160 void TypeEnvironment::add( const std::list< TypeDecl* >&tyDecls ) {161 for ( std::list< TypeDecl* >::const_iterator i = tyDecls.begin(); i != tyDecls.end(); ++i ) {160 void TypeEnvironment::add( const Type::ForallList &tyDecls ) { 161 for ( Type::ForallList::const_iterator i = tyDecls.begin(); i != tyDecls.end(); ++i ) { 162 162 EqvClass newClass; 163 163 newClass.vars.insert( (*i)->get_name() ); -
src/ResolvExpr/TypeEnvironment.h
r3c13c03 r8c49c0e 55 55 bool lookup( const std::string &var, EqvClass &eqvClass ) const; 56 56 void add( const EqvClass &eqvClass ); 57 void add( const std::list< TypeDecl* >&tyDecls );57 void add( const Type::ForallList &tyDecls ); 58 58 template< typename SynTreeClass > int apply( SynTreeClass *&type ) const; 59 59 template< typename SynTreeClass > int applyFree( SynTreeClass *&type ) const; -
src/ResolvExpr/Unify.cc
r3c13c03 r8c49c0e 416 416 417 417 void markAssertions( AssertionSet &assertion1, AssertionSet &assertion2, Type *type ) { 418 for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {418 for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) { 419 419 for ( std::list< DeclarationWithType* >::const_iterator assert = (*tyvar)->get_assertions().begin(); assert != (*tyvar)->get_assertions().end(); ++assert ) { 420 420 markAssertionSet( assertion1, *assert ); -
src/SymTab/Indexer.cc
r3c13c03 r8c49c0e 143 143 for ( DeclarationWithType * decl : copy ) { 144 144 if ( FunctionDecl * function = dynamic_cast< FunctionDecl * >( decl ) ) { 145 std::list< DeclarationWithType * > params = function->get_functionType()->get_parameters();145 std::list< DeclarationWithType * > & params = function->get_functionType()->get_parameters(); 146 146 assert( ! params.empty() ); 147 147 // use base type of pointer, so that qualifiers on the pointer type aren't considered. -
src/SymTab/Mangler.cc
r3c13c03 r8c49c0e 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Mangler.cc -- 7 // Mangler.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 35 35 return mangler.get_mangleName(); 36 36 } 37 37 38 38 Mangler::Mangler( bool mangleOverridable, bool typeMode ) 39 39 : nextVarNum( 0 ), isTopLevel( true ), mangleOverridable( mangleOverridable ), typeMode( typeMode ) {} 40 40 41 41 Mangler::Mangler( const Mangler &rhs ) : mangleName() { 42 42 varNums = rhs.varNums; … … 115 115 "Ir", // LongDoubleImaginary 116 116 }; 117 117 118 118 printQualifiers( basicType ); 119 119 mangleName << btLetter[ basicType->get_kind() ]; … … 245 245 // skip if not including qualifiers 246 246 if ( typeMode ) return; 247 247 248 248 if ( ! type->get_forall().empty() ) { 249 249 std::list< std::string > assertionNames; 250 250 int tcount = 0, dcount = 0, fcount = 0; 251 251 mangleName << "A"; 252 for ( std::list< TypeDecl* >::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {252 for ( Type::ForallList::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) { 253 253 switch ( (*i)->get_kind() ) { 254 254 case TypeDecl::Any: -
src/SymTab/Validate.cc
r3c13c03 r8c49c0e 429 429 /// Fix up assertions 430 430 void forallFixer( Type *func ) { 431 for ( std::list< TypeDecl * >::iterator type = func->get_forall().begin(); type != func->get_forall().end(); ++type ) {431 for ( Type::ForallList::iterator type = func->get_forall().begin(); type != func->get_forall().end(); ++type ) { 432 432 std::list< DeclarationWithType * > toBeDone, nextRound; 433 433 toBeDone.splice( toBeDone.end(), (*type )->get_assertions() ); -
src/SynTree/Expression.cc
r3c13c03 r8c49c0e 318 318 void UntypedMemberExpr::print( std::ostream &os, int indent ) const { 319 319 os << "Untyped Member Expression, with field: " << std::endl; 320 os << std::string( indent+2, ' ' ); 320 321 get_member()->print(os, indent+4); 321 322 os << std::string( indent+2, ' ' ); -
src/SynTree/Type.h
r3c13c03 r8c49c0e 20 20 #include "Visitor.h" 21 21 #include "Mutator.h" 22 #include "Common/utility.h" 22 23 23 24 class Type { … … 64 65 void set_isAtomic( bool newValue ) { tq.isAtomic = newValue; } 65 66 void set_isAttribute( bool newValue ) { tq.isAttribute = newValue; } 66 std::list<TypeDecl*>& get_forall() { return forall; } 67 68 typedef std::list<TypeDecl *> ForallList; 69 ForallList& get_forall() { return forall; } 67 70 68 71 /// How many elemental types are represented by this type … … 76 79 private: 77 80 Qualifiers tq; 78 std::list<TypeDecl*>forall;81 ForallList forall; 79 82 }; 80 83 -
src/SynTree/TypeSubstitution.cc
r3c13c03 r8c49c0e 72 72 Type *TypeSubstitution::lookup( std::string formalType ) const { 73 73 TypeEnvType::const_iterator i = typeEnv.find( formalType ); 74 74 75 75 // break on not in substitution set 76 76 if ( i == typeEnv.end() ) return 0; 77 77 78 78 // attempt to transitively follow TypeInstType links. 79 79 while ( TypeInstType *actualType = dynamic_cast< TypeInstType* >( i->second ) ) { 80 80 const std::string& typeName = actualType->get_name(); 81 81 82 82 // break cycles in the transitive follow 83 83 if ( formalType == typeName ) break; 84 84 85 85 // Look for the type this maps to, returning previous mapping if none-such 86 86 i = typeEnv.find( typeName ); 87 87 if ( i == typeEnv.end() ) return actualType; 88 88 } 89 89 90 90 // return type from substitution set 91 91 return i->second; 92 92 93 93 #if 0 94 94 if ( i == typeEnv.end() ) { … … 149 149 // bind type variables from forall-qualifiers 150 150 if ( freeOnly ) { 151 for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {151 for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) { 152 152 boundVars.insert( (*tyvar )->get_name() ); 153 153 } // for … … 163 163 // bind type variables from forall-qualifiers 164 164 if ( freeOnly ) { 165 for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {165 for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) { 166 166 boundVars.insert( (*tyvar )->get_name() ); 167 167 } // for
Note: See TracChangeset
for help on using the changeset viewer.