Changeset a32b204 for translator/SynTree
- Timestamp:
- May 17, 2015, 1:19:35 PM (11 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 0dd3a2f
- Parents:
- b87a5ed
- Location:
- translator/SynTree
- Files:
-
- 24 edited
-
AddressExpr.cc (modified) (2 diffs)
-
AggregateDecl.cc (modified) (2 diffs)
-
ApplicationExpr.cc (modified) (3 diffs)
-
ArrayType.cc (modified) (2 diffs)
-
AttrType.cc (modified) (1 diff)
-
BasicType.cc (modified) (1 diff)
-
CodeGenVisitor.cc (modified) (2 diffs)
-
Constant.cc (modified) (1 diff)
-
DeclStmt.cc (modified) (1 diff)
-
Declaration.cc (modified) (2 diffs)
-
Expression.cc (modified) (10 diffs)
-
FunctionDecl.cc (modified) (1 diff)
-
Initializer.cc (modified) (1 diff)
-
Mutator.h (modified) (1 diff)
-
NamedTypeDecl.cc (modified) (2 diffs)
-
PointerType.cc (modified) (1 diff)
-
ReferenceToType.cc (modified) (3 diffs)
-
Statement.cc (modified) (13 diffs)
-
Type.cc (modified) (1 diff)
-
TypeExpr.cc (modified) (1 diff)
-
TypeSubstitution.cc (modified) (12 diffs)
-
TypeSubstitution.h (modified) (4 diffs)
-
TypeofType.cc (modified) (1 diff)
-
Visitor.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
translator/SynTree/AddressExpr.cc
rb87a5ed ra32b204 14 14 : Expression( _aname ), arg( arg ) 15 15 { 16 for ( std::list< Type* >::const_iterator i = arg->get_results().begin(); i != arg->get_results().end(); ++i ) {16 for ( std::list< Type* >::const_iterator i = arg->get_results().begin(); i != arg->get_results().end(); ++i ) { 17 17 get_results().push_back( new PointerType( Type::Qualifiers(), (*i)->clone() ) ); 18 18 } … … 33 33 { 34 34 os << std::string( indent, ' ' ) << "Address of:" << std::endl; 35 if ( arg ) {35 if ( arg ) { 36 36 arg->print( os, indent+2 ); 37 37 } -
translator/SynTree/AggregateDecl.cc
rb87a5ed ra32b204 36 36 37 37 os << typeString() << " " << get_name(); 38 if ( !parameters.empty() ) {38 if ( ! parameters.empty() ) { 39 39 os << endl << string( indent+2, ' ' ) << "with parameters" << endl; 40 40 printAll( parameters, os, indent+4 ); 41 41 } 42 if ( !members.empty() ) {42 if ( ! members.empty() ) { 43 43 os << endl << string( indent+2, ' ' ) << "with members" << endl; 44 44 printAll( members, os, indent+4 ); … … 53 53 54 54 os << typeString() << " " << get_name(); 55 if ( !parameters.empty() ) {55 if ( ! parameters.empty() ) { 56 56 os << endl << string( indent+2, ' ' ) << "with parameters" << endl; 57 57 printAll( parameters, os, indent+4 ); -
translator/SynTree/ApplicationExpr.cc
rb87a5ed ra32b204 16 16 ParamEntry::operator=( const ParamEntry &other ) 17 17 { 18 if ( &other == this ) return *this;18 if ( &other == this ) return *this; 19 19 decl = other.decl; 20 20 actualType = maybeClone( other.actualType ); … … 39 39 assert( function ); 40 40 41 for ( std::list< DeclarationWithType* >::const_iterator i = function->get_returnVals().begin(); i != function->get_returnVals().end(); ++i ) {41 for ( std::list< DeclarationWithType* >::const_iterator i = function->get_returnVals().begin(); i != function->get_returnVals().end(); ++i ) { 42 42 get_results().push_back( (*i)->get_type()->clone() ); 43 43 } … … 61 61 os << std::string( indent, ' ' ) << "Application of" << std::endl; 62 62 function->print( os, indent+2 ); 63 if ( !args.empty() ) {63 if ( ! args.empty() ) { 64 64 os << std::string( indent, ' ' ) << "to arguments" << std::endl; 65 65 printAll( args, os, indent+2 ); 66 66 } 67 if ( !inferParams.empty() ) {67 if ( ! inferParams.empty() ) { 68 68 os << std::string(indent, ' ') << "with inferred parameters:" << std::endl; 69 for ( InferredParams::const_iterator i = inferParams.begin(); i != inferParams.end(); ++i ) {69 for ( InferredParams::const_iterator i = inferParams.begin(); i != inferParams.end(); ++i ) { 70 70 os << std::string(indent+2, ' '); 71 71 Declaration::declFromId( i->second.decl )->printShort( os, indent+2 ); -
translator/SynTree/ArrayType.cc
rb87a5ed ra32b204 33 33 { 34 34 Type::print( os, indent ); 35 if ( isStatic ) {35 if ( isStatic ) { 36 36 os << "static "; 37 37 } 38 if ( isVarLen ) {38 if ( isVarLen ) { 39 39 os << "variable length array of "; 40 } else if ( dimension ) {40 } else if ( dimension ) { 41 41 os << "array of "; 42 42 dimension->print( os, indent ); … … 44 44 os << "open array of "; 45 45 } 46 if ( base ) {46 if ( base ) { 47 47 base->print( os, indent ); 48 48 } -
translator/SynTree/AttrType.cc
rb87a5ed ra32b204 37 37 Type::print( os, indent ); 38 38 os << "attribute " << name << " applied to "; 39 if ( expr ) {39 if ( expr ) { 40 40 os << "expression "; 41 41 expr->print( os, indent ); 42 42 } 43 if ( type ) {43 if ( type ) { 44 44 os << "type "; 45 45 type->print( os, indent ); -
translator/SynTree/BasicType.cc
rb87a5ed ra32b204 19 19 20 20 bool BasicType::isInteger() const { 21 switch ( kind ) {21 switch ( kind ) { 22 22 case Bool: 23 23 case Char: -
translator/SynTree/CodeGenVisitor.cc
rb87a5ed ra32b204 20 20 21 21 void CodeGenVisitor::visit(ConstantExpr *cnst){ 22 if (cnst != 0)22 if (cnst != 0) 23 23 visit(cnst->get_constant()); 24 24 } … … 28 28 29 29 void CodeGenVisitor::visit(ExprStmt *exprStmt){ 30 if (exprStmt != 0)30 if (exprStmt != 0) 31 31 exprStmt->get_expr()->accept(*this); // visit(exprStmt->get_expr()) doesn't work 32 32 } 33 33 34 34 void CodeGenVisitor::visit(SwitchStmt *switchStmt){ 35 cout << "switch (" << endl;35 cout << "switch (" << endl; 36 36 // visit(switchStmt->get_condition()); // why doesn't this work? 37 37 switchStmt->get_condition()->accept(*this); -
translator/SynTree/Constant.cc
rb87a5ed ra32b204 15 15 void Constant::print( std::ostream &os ) const { 16 16 os << value; 17 if ( type ) {17 if ( type ) { 18 18 os << " (type: "; 19 19 type->print( os ); -
translator/SynTree/DeclStmt.cc
rb87a5ed ra32b204 30 30 { 31 31 os << "Declaration of "; 32 if ( decl ) {32 if ( decl ) { 33 33 decl->print( os, indent ); 34 34 } -
translator/SynTree/Declaration.cc
rb87a5ed ra32b204 47 47 { 48 48 IdMapType::const_iterator i = idMap.find( id ); 49 if ( i != idMap.end() ) {49 if ( i != idMap.end() ) { 50 50 return i->second; 51 51 } else { … … 58 58 Declaration::dumpIds( std::ostream &os ) 59 59 { 60 for ( IdMapType::const_iterator i = idMap.begin(); i != idMap.end(); ++i ) {60 for ( IdMapType::const_iterator i = idMap.begin(); i != idMap.end(); ++i ) { 61 61 os << i->first << " -> "; 62 62 i->second->printShort( os ); -
translator/SynTree/Expression.cc
rb87a5ed ra32b204 32 32 Expression::add_result( Type *t ) 33 33 { 34 if ( TupleType *tuple = dynamic_cast< TupleType* >( t ) ) {34 if ( TupleType *tuple = dynamic_cast< TupleType* >( t ) ) { 35 35 std::copy( tuple->get_types().begin(), tuple->get_types().end(), back_inserter( results ) ); 36 36 } else { … … 40 40 41 41 void Expression::print(std::ostream &os, int indent) const { 42 if ( env ) {42 if ( env ) { 43 43 os << std::string(indent, ' ') << "with environment:" << std::endl; 44 44 env->print( os, indent+2 ); 45 45 } 46 46 47 if ( argName ) {47 if ( argName ) { 48 48 os << std::string(indent, ' ') << "with designator:"; 49 49 argName->print( os, indent+2 ); … … 75 75 { 76 76 add_result( var->get_type()->clone() ); 77 for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) {77 for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) { 78 78 (*i)->set_isLvalue( true ); 79 79 } … … 94 94 95 95 Declaration *decl = get_var(); 96 // if ( decl != 0) decl->print(os, indent + 2);97 if ( decl != 0) decl->printShort(os, indent + 2);96 // if ( decl != 0) decl->print(os, indent + 2); 97 if ( decl != 0) decl->printShort(os, indent + 2); 98 98 os << std::endl; 99 99 Expression::print( os, indent ); … … 126 126 os << std::string(indent, ' ') << "Sizeof Expression on: "; 127 127 128 if (isType)128 if (isType) 129 129 type->print(os, indent + 2); 130 130 else … … 160 160 os << std::string(indent, ' ') << "Attr "; 161 161 attr->print( os, indent + 2 ); 162 if ( isType || expr ) {162 if ( isType || expr ) { 163 163 os << "applied to: "; 164 164 165 if (isType)165 if (isType) 166 166 type->print(os, indent + 2); 167 167 else … … 197 197 arg->print(os, indent+2); 198 198 os << std::endl << std::string(indent, ' ') << "to:" << std::endl; 199 if ( results.empty() ) {199 if ( results.empty() ) { 200 200 os << std::string(indent+2, ' ') << "nothing" << std::endl; 201 201 } else { … … 233 233 { 234 234 add_result( member->get_type()->clone() ); 235 for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) {235 for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) { 236 236 (*i)->set_isLvalue( true ); 237 237 } … … 287 287 void UntypedExpr::printArgs(std::ostream &os, int indent ) const { 288 288 std::list<Expression *>::const_iterator i; 289 for (i = args.begin(); i != args.end(); i++)289 for (i = args.begin(); i != args.end(); i++) 290 290 (*i)->print(os, indent); 291 291 } … … 362 362 { 363 363 os << std::string(indent, ' ') << "Valof Expression: " << std::endl; 364 if ( get_body() != 0 )364 if ( get_body() != 0 ) 365 365 get_body()->print( os, indent + 2 ); 366 366 } -
translator/SynTree/FunctionDecl.cc
rb87a5ed ra32b204 56 56 if ( ! oldIdents.empty() ) { 57 57 os << string( indent+2, ' ' ) << "with parameter names" << endl; 58 for ( std::list< std::string >::const_iterator i = oldIdents.begin(); i != oldIdents.end(); ++i ) {58 for ( std::list< std::string >::const_iterator i = oldIdents.begin(); i != oldIdents.end(); ++i ) { 59 59 os << string( indent+4, ' ' ) << *i << endl; 60 60 } -
translator/SynTree/Initializer.cc
rb87a5ed ra32b204 61 61 } 62 62 63 for ( std::list<Initializer *>::iterator i = initializers.begin(); i != initializers.end(); i++ )63 for ( std::list<Initializer *>::iterator i = initializers.begin(); i != initializers.end(); i++ ) 64 64 (*i)->print( os, indent + 2 ); 65 65 } -
translator/SynTree/Mutator.h
rb87a5ed ra32b204 110 110 } 111 111 } 112 if ( ! errors.isEmpty() ) {112 if ( ! errors.isEmpty() ) { 113 113 throw errors; 114 114 } -
translator/SynTree/NamedTypeDecl.cc
rb87a5ed ra32b204 35 35 base->print( os, indent ); 36 36 } // if 37 if ( ! parameters.empty() ) {37 if ( ! parameters.empty() ) { 38 38 os << endl << string( indent, ' ' ) << "with parameters" << endl; 39 39 printAll( parameters, os, indent+2 ); 40 40 } // if 41 if ( ! assertions.empty() ) {41 if ( ! assertions.empty() ) { 42 42 os << endl << string( indent, ' ' ) << "with assertions" << endl; 43 43 printAll( assertions, os, indent+2 ); … … 59 59 base->print( os, indent ); 60 60 } // if 61 if ( ! parameters.empty() ) {61 if ( ! parameters.empty() ) { 62 62 os << endl << string( indent, ' ' ) << "with parameters" << endl; 63 63 printAll( parameters, os, indent+2 ); -
translator/SynTree/PointerType.cc
rb87a5ed ra32b204 40 40 Type::print( os, indent ); 41 41 os << "pointer to "; 42 if ( isStatic ) {42 if ( isStatic ) { 43 43 os << "static "; 44 44 } 45 if ( isVarLen ) {45 if ( isVarLen ) { 46 46 os << "variable length array of "; 47 } else if ( dimension ) {47 } else if ( dimension ) { 48 48 os << "array of "; 49 49 dimension->print( os, indent ); 50 50 } 51 if ( base ) {51 if ( base ) { 52 52 base->print( os, indent ); 53 53 } -
translator/SynTree/ReferenceToType.cc
rb87a5ed ra32b204 39 39 Type::print( os, indent ); 40 40 os << "instance of " << typeString() << " " << name << " "; 41 if ( !parameters.empty() ) {41 if ( ! parameters.empty() ) { 42 42 os << endl << std::string( indent, ' ' ) << "with parameters" << endl; 43 43 printAll( parameters, os, indent+2 ); … … 51 51 { 52 52 std::list< Declaration* > found; 53 for ( std::list< Declaration* >::const_iterator i = members.begin(); i != members.end(); ++i ) {54 if ( (*i)->get_name() == name ) {53 for ( std::list< Declaration* >::const_iterator i = members.begin(); i != members.end(); ++i ) { 54 if ( (*i)->get_name() == name ) { 55 55 found.push_back( *i ); 56 56 } … … 118 118 Type::print( os, indent ); 119 119 os << "instance of " << typeString() << " " << get_name() << " (" << ( isFtype ? "" : "not" ) << " a function type) "; 120 if ( !parameters.empty() ) {120 if ( ! parameters.empty() ) { 121 121 os << endl << std::string( indent, ' ' ) << "with parameters" << endl; 122 122 printAll( parameters, os, indent+2 ); -
translator/SynTree/Statement.cc
rb87a5ed ra32b204 38 38 { 39 39 //actually this is a syntactic error signaled by the parser 40 if (type == BranchStmt::Goto && target.size() == 0)40 if (type == BranchStmt::Goto && target.size() == 0) 41 41 throw SemanticError("goto without target"); 42 42 } … … 46 46 Statement(labels), computedTarget(_computedTarget), type(_type) 47 47 { 48 if (type != BranchStmt::Goto || computedTarget == 0)48 if (type != BranchStmt::Goto || computedTarget == 0) 49 49 throw SemanticError("Computed target not valid in branch statement"); 50 50 } … … 63 63 void ReturnStmt::print( std::ostream &os, int indent ){ 64 64 os << "\r" << std::string(indent, ' ') << string ( isThrow? "Throw":"Return" ) << " Statement, returning: "; 65 if (expr != 0) expr->print(os);65 if (expr != 0) expr->print(os); 66 66 os << endl; 67 67 } … … 81 81 thenPart->print(os, indent + 4); 82 82 83 if (elsePart != 0){83 if (elsePart != 0){ 84 84 elsePart->print(os, indent + 4); 85 85 } … … 104 104 // branches 105 105 std::list<Statement *>::iterator i; 106 for (i = branches.begin(); i != branches.end(); i++)106 for (i = branches.begin(); i != branches.end(); i++) 107 107 (*i)->print(os, indent + 4); 108 108 … … 115 115 Statement(_labels), condition(_condition), stmts(_statements), _isDefault(deflt) 116 116 { 117 if (isDefault() && condition != 0)117 if (isDefault() && condition != 0) 118 118 throw SemanticError("default with conditions"); 119 119 } … … 126 126 os << "\r" << string(indent, ' '); 127 127 128 if (isDefault())128 if (isDefault()) 129 129 os << "Default "; 130 130 else { … … 136 136 137 137 std::list<Statement *>::iterator i; 138 for (i = stmts.begin(); i != stmts.end(); i++)138 for (i = stmts.begin(); i != stmts.end(); i++) 139 139 (*i)->print(os, indent + 4); 140 140 } … … 158 158 // branches 159 159 std::list<Statement *>::iterator i; 160 for (i = branches.begin(); i != branches.end(); i++)160 for (i = branches.begin(); i != branches.end(); i++) 161 161 (*i)->print(os, indent + 4); 162 162 … … 183 183 os << string(indent, ' ') << ".... with body: " << endl; 184 184 185 if (body != 0) body->print(os, indent + 4);185 if (body != 0) body->print(os, indent + 4); 186 186 } 187 187 … … 216 216 217 217 os << "\n\r" << string(indent + 2, ' ') << "statement block: \n"; 218 if (body != 0)218 if (body != 0) 219 219 body->print(os, indent + 4); 220 220 … … 244 244 os << string(indent + 2, ' ') << "and handlers: " << endl; 245 245 std::list<Statement *>::iterator i; 246 for (i = handlers.begin(); i != handlers.end(); i++)246 for (i = handlers.begin(); i != handlers.end(); i++) 247 247 (*i)->print(os, indent + 4); 248 248 … … 267 267 268 268 os << "\r" << string(indent, ' ') << "... catching" << endl; 269 if ( decl ) {269 if ( decl ) { 270 270 decl->printShort( os, indent + 4 ); 271 271 os << endl; -
translator/SynTree/Type.cc
rb87a5ed ra32b204 40 40 41 41 void Type::print( std::ostream &os, int indent ) const { 42 if ( ! forall.empty() ) {42 if ( ! forall.empty() ) { 43 43 os << "forall" << std::endl; 44 44 printAll( forall, os, indent + 4 ); -
translator/SynTree/TypeExpr.cc
rb87a5ed ra32b204 29 29 TypeExpr::print( std::ostream &os, int indent ) const 30 30 { 31 if ( type ) type->print( os, indent );31 if ( type ) type->print( os, indent ); 32 32 Expression::print( os, indent ); 33 33 } -
translator/SynTree/TypeSubstitution.cc
rb87a5ed ra32b204 21 21 TypeSubstitution::~TypeSubstitution() 22 22 { 23 for ( TypeEnvType::iterator i = typeEnv.begin(); i != typeEnv.end(); ++i ) {23 for ( TypeEnvType::iterator i = typeEnv.begin(); i != typeEnv.end(); ++i ) { 24 24 delete( i->second ); 25 25 } 26 for ( VarEnvType::iterator i = varEnv.begin(); i != varEnv.end(); ++i ) {26 for ( VarEnvType::iterator i = varEnv.begin(); i != varEnv.end(); ++i ) { 27 27 delete( i->second ); 28 28 } … … 32 32 TypeSubstitution::operator=( const TypeSubstitution &other ) 33 33 { 34 if ( this == &other ) return *this;34 if ( this == &other ) return *this; 35 35 initialize( other, *this ); 36 36 return *this; … … 48 48 TypeSubstitution::add( const TypeSubstitution &other ) 49 49 { 50 for ( TypeEnvType::const_iterator i = other.typeEnv.begin(); i != other.typeEnv.end(); ++i ) {50 for ( TypeEnvType::const_iterator i = other.typeEnv.begin(); i != other.typeEnv.end(); ++i ) { 51 51 typeEnv[ i->first ] = i->second->clone(); 52 52 } 53 for ( VarEnvType::const_iterator i = other.varEnv.begin(); i != other.varEnv.end(); ++i ) {53 for ( VarEnvType::const_iterator i = other.varEnv.begin(); i != other.varEnv.end(); ++i ) { 54 54 varEnv[ i->first ] = i->second->clone(); 55 55 } … … 60 60 { 61 61 TypeEnvType::iterator i = typeEnv.find( formalType ); 62 if ( i != typeEnv.end() ) {62 if ( i != typeEnv.end() ) { 63 63 delete i->second; 64 64 } … … 70 70 { 71 71 TypeEnvType::iterator i = typeEnv.find( formalType ); 72 if ( i != typeEnv.end() ) {72 if ( i != typeEnv.end() ) { 73 73 delete i->second; 74 74 typeEnv.erase( formalType ); … … 80 80 { 81 81 TypeEnvType::const_iterator i = typeEnv.find( formalType ); 82 if ( i == typeEnv.end() ) {82 if ( i == typeEnv.end() ) { 83 83 return 0; 84 84 } else { … … 99 99 subCount = 0; 100 100 freeOnly = true; 101 for ( TypeEnvType::iterator i = typeEnv.begin(); i != typeEnv.end(); ++i ) {101 for ( TypeEnvType::iterator i = typeEnv.begin(); i != typeEnv.end(); ++i ) { 102 102 i->second = i->second->acceptMutator( *this ); 103 103 } 104 } while ( subCount );104 } while ( subCount ); 105 105 } 106 106 … … 109 109 { 110 110 BoundVarsType::const_iterator bound = boundVars.find( inst->get_name() ); 111 if ( bound != boundVars.end() ) return inst;111 if ( bound != boundVars.end() ) return inst; 112 112 113 113 TypeEnvType::const_iterator i = typeEnv.find( inst->get_name() ); 114 if ( i == typeEnv.end() ) {114 if ( i == typeEnv.end() ) { 115 115 return inst; 116 116 } else { … … 130 130 { 131 131 VarEnvType::const_iterator i = varEnv.find( nameExpr->get_name() ); 132 if ( i == varEnv.end() ) {132 if ( i == varEnv.end() ) { 133 133 return nameExpr; 134 134 } else { … … 144 144 { 145 145 BoundVarsType oldBoundVars( boundVars ); 146 if ( freeOnly ) {147 for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {146 if ( freeOnly ) { 147 for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) { 148 148 boundVars.insert( (*tyvar)->get_name() ); 149 149 } … … 218 218 { 219 219 os << std::string( indent, ' ' ) << "Types:" << std::endl; 220 for ( TypeEnvType::const_iterator i = typeEnv.begin(); i != typeEnv.end(); ++i ) {220 for ( TypeEnvType::const_iterator i = typeEnv.begin(); i != typeEnv.end(); ++i ) { 221 221 os << std::string( indent+2, ' ' ) << i->first << " -> "; 222 222 i->second->print( os, indent+4 ); … … 224 224 } 225 225 os << std::string( indent, ' ' ) << "Non-types:" << std::endl; 226 for ( VarEnvType::const_iterator i = varEnv.begin(); i != varEnv.end(); ++i ) {226 for ( VarEnvType::const_iterator i = varEnv.begin(); i != varEnv.end(); ++i ) { 227 227 os << std::string( indent+2, ' ' ) << i->first << " -> "; 228 228 i->second->print( os, indent+4 ); -
translator/SynTree/TypeSubstitution.h
rb87a5ed ra32b204 90 90 FormalIterator formalIt = formalBegin; 91 91 ActualIterator actualIt = actualBegin; 92 for ( ; formalIt != formalEnd; ++formalIt, ++actualIt ) {93 if ( TypeDecl *formal = dynamic_cast< TypeDecl* >( *formalIt ) ) {94 if ( TypeExpr *actual = dynamic_cast< TypeExpr* >( *actualIt ) ) {95 if ( formal->get_name() != "" ) {92 for ( ; formalIt != formalEnd; ++formalIt, ++actualIt ) { 93 if ( TypeDecl *formal = dynamic_cast< TypeDecl* >( *formalIt ) ) { 94 if ( TypeExpr *actual = dynamic_cast< TypeExpr* >( *actualIt ) ) { 95 if ( formal->get_name() != "" ) { 96 96 TypeEnvType::iterator i = typeEnv.find( formal->get_name() ); 97 if ( i != typeEnv.end() ) {97 if ( i != typeEnv.end() ) { 98 98 delete i->second; 99 99 } … … 105 105 } else { 106 106 // TODO: type check the formal and actual parameters 107 if ( (*formalIt)->get_name() != "" ) {107 if ( (*formalIt)->get_name() != "" ) { 108 108 varEnv[ (*formalIt)->get_name() ] = (*actualIt)->clone(); 109 109 } … … 152 152 TypeSubstitution::extract( TypeInstListIterator begin, TypeInstListIterator end, TypeSubstitution &result ) 153 153 { 154 while ( begin != end ) {154 while ( begin != end ) { 155 155 TypeEnvType::iterator cur = typeEnv.find( (*begin++)->get_name() ); 156 if ( cur != typeEnv.end() ) {156 if ( cur != typeEnv.end() ) { 157 157 result.typeEnv[ cur->first ] = cur->second; 158 158 typeEnv.erase( cur ); … … 170 170 171 171 TypeSubstitution sub = TypeSubstitution( formalBegin, formalEnd, actual ); 172 for ( std::list< Declaration* >::iterator i = memberBegin; i != memberEnd; ++i ) {172 for ( std::list< Declaration* >::iterator i = memberBegin; i != memberEnd; ++i ) { 173 173 Declaration *newdecl = (*i)->clone(); 174 174 sub.apply( newdecl ); -
translator/SynTree/TypeofType.cc
rb87a5ed ra32b204 31 31 Type::print( os, indent ); 32 32 os << "type-of expression "; 33 if ( expr ) {33 if ( expr ) { 34 34 expr->print( os, indent ); 35 35 } -
translator/SynTree/Visitor.h
rb87a5ed ra32b204 103 103 } 104 104 } 105 if ( ! errors.isEmpty() ) {105 if ( ! errors.isEmpty() ) { 106 106 throw errors; 107 107 } … … 129 129 } 130 130 } 131 if ( ! errors.isEmpty() ) {131 if ( ! errors.isEmpty() ) { 132 132 throw errors; 133 133 }
Note:
See TracChangeset
for help on using the changeset viewer.