- Timestamp:
- Jan 31, 2018, 4:53:23 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, 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:
- c453ac4
- Parents:
- 4670c79
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Resolver.cc
r4670c79 rc28a038d 82 82 void previsit( ConstructorInit *ctorInit ); 83 83 private: 84 84 typedef std::list< Initializer * >::iterator InitIterator; 85 85 86 86 template< typename PtrType > 87 87 void handlePtrType( PtrType * type ); 88 88 89 void resolveAggrInit( ReferenceToType *, InitIterator &, InitIterator & ); 90 void resolveSingleAggrInit( Declaration *, InitIterator &, InitIterator &, TypeSubstitution sub ); 91 void fallbackInit( ConstructorInit * ctorInit ); 89 void resolveWithExprs( std::list< Expression * > & withExprs, std::list< Statement * > & newStmts ); 90 void fallbackInit( ConstructorInit * ctorInit ); 92 91 93 92 Type * functionReturn = nullptr; … … 269 268 std::cerr << std::endl; 270 269 #endif 271 Type *new_type = resolveTypeof( functionDecl-> get_type(), indexer );270 Type *new_type = resolveTypeof( functionDecl->type, indexer ); 272 271 functionDecl->set_type( new_type ); 273 272 GuardValue( functionReturn ); … … 279 278 // xxx - it might be necessary to somehow keep the information from this environment, but I can't currently 280 279 // see how it's useful. 281 for ( Declaration * d : functionDecl-> get_functionType()->get_parameters()) {280 for ( Declaration * d : functionDecl->type->parameters ) { 282 281 if ( ObjectDecl * obj = dynamic_cast< ObjectDecl * >( d ) ) { 283 if ( SingleInit * init = dynamic_cast< SingleInit * >( obj-> get_init()) ) {284 delete init-> get_value()->get_env();285 init-> get_value()->set_env( nullptr );282 if ( SingleInit * init = dynamic_cast< SingleInit * >( obj->init ) ) { 283 delete init->value->env; 284 init->value->env = nullptr; 286 285 } 287 286 } … … 584 583 } 585 584 586 587 void Resolver::previsit( WithStmt * withStmt ) { 588 for ( Expression *& expr : withStmt->exprs ) { 585 void Resolver::resolveWithExprs( std::list< Expression * > & withExprs, std::list< Statement * > & newStmts ) { 586 for ( Expression *& expr : withExprs ) { 589 587 // only struct- and union-typed expressions are viable candidates 590 588 findKindExpression( expr, indexer, "with statement", isStructOrUnion ); … … 595 593 ObjectDecl * tmp = ObjectDecl::newObject( tmpNamer.newName(), expr->result->clone(), new SingleInit( expr ) ); 596 594 expr = new VariableExpr( tmp ); 597 stmtsToAddBefore.push_back( new DeclStmt( tmp ) );595 newStmts.push_back( new DeclStmt( tmp ) ); 598 596 if ( InitTweak::isConstructable( tmp->type ) ) { 599 597 // generate ctor/dtor and resolve them … … 603 601 } 604 602 } 603 } 604 605 void Resolver::previsit( WithStmt * withStmt ) { 606 resolveWithExprs( withStmt->exprs, stmtsToAddBefore ); 605 607 } 606 608
Note: See TracChangeset
for help on using the changeset viewer.