Changeset 88d1066 for src


Ignore:
Timestamp:
Mar 14, 2017, 2:45:16 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
2f26687a
Parents:
235114f
Message:

remove environments from default argument expressions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    r235114f r88d1066  
    240240                functionReturn = ResolvExpr::extractResultType( functionDecl->get_functionType() );
    241241                Parent::visit( functionDecl );
     242
     243                // default value expressions have an environment which shouldn't be there and trips up later passes.
     244                // xxx - it might be necessary to somehow keep the information from this environment, but I can't currently
     245                // see how it's useful.
     246                for ( Declaration * d : functionDecl->get_functionType()->get_parameters() ) {
     247                        if ( ObjectDecl * obj = dynamic_cast< ObjectDecl * >( d ) ) {
     248                                if ( SingleInit * init = dynamic_cast< SingleInit * >( obj->get_init() ) ) {
     249                                        delete init->get_value()->get_env();
     250                                        init->get_value()->set_env( nullptr );
     251                                }
     252                        }
     253                }
    242254        }
    243255
Note: See TracChangeset for help on using the changeset viewer.