Ignore:
Timestamp:
May 11, 2015, 3:11:49 PM (11 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
b1a6d6b, c11e31c
Parents:
48e99f2
Message:

for loop initializers are hoisted properly and for loops a level of scope

File:
1 edited

Legend:

Unmodified
Added
Removed
  • translator/ControlStruct/ForExprMutator.cc

    r48e99f2 rd4778a6  
    55namespace ControlStruct {
    66    Statement *ForExprMutator::mutate( ForStmt *forStmt ) {
    7         DeclStmt *decl;
    8         if (( decl = dynamic_cast< DeclStmt * > ( forStmt->get_initialization() )) != 0 ) {
     7        forStmt->set_body( forStmt->get_body()->acceptMutator( *this ) );
     8        if ( DeclStmt *decl = dynamic_cast< DeclStmt * > ( forStmt->get_initialization() ) ) {
    99            // create compound statement, move declaration outside, leave _for_ as-is
    1010            CompoundStmt *block = new CompoundStmt( std::list< Label >() );
Note: See TracChangeset for help on using the changeset viewer.