Changeset 3cfe27f for src/ResolvExpr


Ignore:
Timestamp:
Mar 24, 2016, 4:45:23 PM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
1f6e009, 3aba311, 53ba273, b3f9a0cb
Parents:
6a57da5
Message:

fix initialization of routine pointers, fix one random routine

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    r6a57da5 r3cfe27f  
    1010// Created On       : Sun May 17 12:17:01 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb  9 21:57:52 2016
    13 // Update Count     : 179
     12// Last Modified On : Thu Mar 24 16:43:11 2016
     13// Update Count     : 181
    1414//
    1515
     
    165165                Type *new_type = resolveTypeof( objectDecl->get_type(), *this );
    166166                objectDecl->set_type( new_type );
     167                // To handle initialization of routine pointers, e.g., int (*fp)(int) = foo(), means that class-variable
     168                // initContext is changed multiple time because the LHS is analysed twice. The second analysis changes
     169                // initContext because of a function type can contain object declarations in the return and parameter types. So
     170                // each value of initContext is retained, so the type on the first analysis is preserved and used for selecting
     171                // the RHS.
     172                Type *temp = initContext;
    167173                initContext = new_type;
    168174                SymTab::Indexer::visit( objectDecl );
     175                initContext = temp;
    169176        }
    170177
Note: See TracChangeset for help on using the changeset viewer.