Changeset bbbc067 for src/ResolvExpr
- Timestamp:
- Jan 29, 2019, 4:30:46 PM (6 years ago)
- Branches:
- no_list
- Children:
- 8d25360
- Parents:
- bee0694
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Resolver.cc
rbee0694 rbbbc067 80 80 void previsit( ConstructorInit *ctorInit ); 81 81 private: 82 typedef std:: list< Initializer * >::iterator InitIterator;82 typedef std::vector< Initializer * >::iterator InitIterator; 83 83 84 84 template< typename PtrType > … … 235 235 winner.cost = winner.cvtCost; 236 236 } 237 237 238 238 // produce ambiguous errors, if applicable 239 239 if ( winners.size() != 1 ) { … … 255 255 256 256 // xxx - check for ambiguous expressions 257 257 258 258 // output selected choice 259 259 alt = std::move( choice ); … … 402 402 403 403 void Resolver::previsit( ObjectDecl *objectDecl ) { 404 // To handle initialization of routine pointers, e.g., int (*fp)(int) = foo(), means that 405 // class-variable initContext is changed multiple time because the LHS is analysed twice. 406 // The second analysis changes initContext because of a function type can contain object 407 // declarations in the return and parameter types. So each value of initContext is 404 // To handle initialization of routine pointers, e.g., int (*fp)(int) = foo(), means that 405 // class-variable initContext is changed multiple time because the LHS is analysed twice. 406 // The second analysis changes initContext because of a function type can contain object 407 // declarations in the return and parameter types. So each value of initContext is 408 408 // retained, so the type on the first analysis is preserved and used for selecting the RHS. 409 409 GuardValue( currentObject ); … … 442 442 443 443 void Resolver::postvisit( FunctionDecl *functionDecl ) { 444 // default value expressions have an environment which shouldn't be there and trips up 444 // default value expressions have an environment which shouldn't be there and trips up 445 445 // later passes. 446 // xxx - it might be necessary to somehow keep the information from this environment, but I 446 // xxx - it might be necessary to somehow keep the information from this environment, but I 447 447 // can't currently see how it's useful. 448 448 for ( Declaration * d : functionDecl->type->parameters ) { … … 795 795 initExpr->expr = nullptr; 796 796 std::swap( initExpr->env, newExpr->env ); 797 // InitExpr may have inferParams in the case where the expression specializes a function 798 // pointer, and newExpr may already have inferParams of its own, so a simple swap is not 797 // InitExpr may have inferParams in the case where the expression specializes a function 798 // pointer, and newExpr may already have inferParams of its own, so a simple swap is not 799 799 // sufficient. 800 800 newExpr->spliceInferParams( initExpr ); 801 801 delete initExpr; 802 802 803 // get the actual object's type (may not exactly match what comes back from the resolver 803 // get the actual object's type (may not exactly match what comes back from the resolver 804 804 // due to conversions) 805 805 Type * initContext = currentObject.getCurrentType(); … … 814 814 if ( isCharType( pt->get_base() ) ) { 815 815 if ( CastExpr *ce = dynamic_cast< CastExpr * >( newExpr ) ) { 816 // strip cast if we're initializing a char[] with a char *, 816 // strip cast if we're initializing a char[] with a char *, 817 817 // e.g. char x[] = "hello"; 818 818 newExpr = ce->get_arg(); … … 837 837 // move cursor into brace-enclosed initializer-list 838 838 currentObject.enterListInit(); 839 // xxx - fix this so that the list isn't copied, iterator should be used to change current 839 // xxx - fix this so that the list isn't copied, iterator should be used to change current 840 840 // element 841 841 std::list<Designation *> newDesignations; 842 842 for ( auto p : group_iterate(listInit->get_designations(), listInit->get_initializers()) ) { 843 // iterate designations and initializers in pairs, moving the cursor to the current 843 // iterate designations and initializers in pairs, moving the cursor to the current 844 844 // designated object and resolving the initializer against that object. 845 845 Designation * des = std::get<0>(p);
Note: See TracChangeset
for help on using the changeset viewer.