ADT
        aaron-thesis
        arm-eh
        ast-experimental
        cleanup-dtors
        ctor
        deferred_resn
        demangler
        enum
        forall-pointer-decay
        gc_noraii
        jacob/cs343-translation
        jenkins-sandbox
        memory
        new-ast
        new-ast-unique-expr
        new-env
        no_list
        persistent-indexer
        pthread-emulation
        qualifiedEnum
        resolv-new
        string
        with_gc
      
      
        
          | Last change
 on this file since fe3b61b was             d9a0e76, checked in by Peter A. Buhr <pabuhr@…>, 11 years ago | 
        
          | 
remove Parser.old, add -XCFA to driver, copy ptrdiff_t from stddef.h in preclude, remove casts from initialization constants, adjust formatting
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            711 bytes | 
      
      
| Line |  | 
|---|
| 1 | #include "SynTree/Mutator.h" | 
|---|
| 2 | #include "SynTree/Statement.h" | 
|---|
| 3 | #include "ForExprMutator.h" | 
|---|
| 4 |  | 
|---|
| 5 | namespace ControlStruct { | 
|---|
| 6 | Statement *ForExprMutator::mutate( ForStmt *forStmt ) { | 
|---|
| 7 | DeclStmt *decl; | 
|---|
| 8 | if (( decl = dynamic_cast< DeclStmt * > ( forStmt->get_initialization() )) != 0 ) { | 
|---|
| 9 | // create compound statement, move declaration outside, leave _for_ as-is | 
|---|
| 10 | CompoundStmt *block = new CompoundStmt( std::list< Label >() ); | 
|---|
| 11 | std::list<Statement *> &stmts = block->get_kids(); | 
|---|
| 12 |  | 
|---|
| 13 | stmts.push_back( decl ); | 
|---|
| 14 | forStmt->set_initialization( 0 ); | 
|---|
| 15 | stmts.push_back( forStmt ); | 
|---|
| 16 |  | 
|---|
| 17 | return block; | 
|---|
| 18 | } // if | 
|---|
| 19 | // ForStmt still needs to be fixed | 
|---|
| 20 | else | 
|---|
| 21 | return forStmt; | 
|---|
| 22 | } | 
|---|
| 23 | } // namespace ControlStruct | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.