Changeset f57dd25 for src/ResolvExpr
- Timestamp:
- May 29, 2019, 3:45:00 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 0aedb01
- Parents:
- 157a816 (diff), ebc0a85 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
src/ResolvExpr/Resolver.cc (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Resolver.cc
r157a816 rf57dd25 43 43 #include "typeops.h" // for extractResultType 44 44 #include "Unify.h" // for unify 45 #include "Validate/FindSpecialDecls.h" // for SizeType 45 46 46 47 using namespace std; … … 235 236 winner.cost = winner.cvtCost; 236 237 } 237 238 238 239 // produce ambiguous errors, if applicable 239 240 if ( winners.size() != 1 ) { … … 255 256 256 257 // xxx - check for ambiguous expressions 257 258 258 259 // output selected choice 259 260 alt = std::move( choice ); … … 402 403 403 404 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 405 // To handle initialization of routine pointers, e.g., int (*fp)(int) = foo(), means that 406 // class-variable initContext is changed multiple time because the LHS is analysed twice. 407 // The second analysis changes initContext because of a function type can contain object 408 // declarations in the return and parameter types. So each value of initContext is 408 409 // retained, so the type on the first analysis is preserved and used for selecting the RHS. 409 410 GuardValue( currentObject ); … … 419 420 void Resolver::handlePtrType( PtrType * type ) { 420 421 if ( type->get_dimension() ) { 421 findSingleExpression( type->dimension, SymTab::SizeType->clone(), indexer );422 findSingleExpression( type->dimension, Validate::SizeType->clone(), indexer ); 422 423 } 423 424 } … … 442 443 443 444 void Resolver::postvisit( FunctionDecl * functionDecl ) { 444 // default value expressions have an environment which shouldn't be there and trips up 445 // default value expressions have an environment which shouldn't be there and trips up 445 446 // later passes. 446 // xxx - it might be necessary to somehow keep the information from this environment, but I 447 // xxx - it might be necessary to somehow keep the information from this environment, but I 447 448 // can't currently see how it's useful. 448 449 for ( Declaration * d : functionDecl->type->parameters ) { … … 795 796 initExpr->expr = nullptr; 796 797 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 798 // InitExpr may have inferParams in the case where the expression specializes a function 799 // pointer, and newExpr may already have inferParams of its own, so a simple swap is not 799 800 // sufficient. 800 801 newExpr->spliceInferParams( initExpr ); 801 802 delete initExpr; 802 803 803 // get the actual object's type (may not exactly match what comes back from the resolver 804 // get the actual object's type (may not exactly match what comes back from the resolver 804 805 // due to conversions) 805 806 Type * initContext = currentObject.getCurrentType(); … … 814 815 if ( isCharType( pt->get_base() ) ) { 815 816 if ( CastExpr * ce = dynamic_cast< CastExpr * >( newExpr ) ) { 816 // strip cast if we're initializing a char[] with a char *, 817 // strip cast if we're initializing a char[] with a char *, 817 818 // e.g. char x[] = "hello"; 818 819 newExpr = ce->get_arg(); … … 837 838 // move cursor into brace-enclosed initializer-list 838 839 currentObject.enterListInit(); 839 // xxx - fix this so that the list isn't copied, iterator should be used to change current 840 // xxx - fix this so that the list isn't copied, iterator should be used to change current 840 841 // element 841 842 std::list<Designation *> newDesignations; 842 843 for ( auto p : group_iterate(listInit->get_designations(), listInit->get_initializers()) ) { 843 // iterate designations and initializers in pairs, moving the cursor to the current 844 // iterate designations and initializers in pairs, moving the cursor to the current 844 845 // designated object and resolving the initializer against that object. 845 846 Designation * des = std::get<0>(p);
Note:
See TracChangeset
for help on using the changeset viewer.