Changeset 938dd75


Ignore:
Timestamp:
Mar 2, 2018, 5:34:52 PM (6 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:
000ff2c
Parents:
b8baa37
git-author:
Rob Schluntz <rschlunt@…> (03/02/18 17:22:17)
git-committer:
Rob Schluntz <rschlunt@…> (03/02/18 17:34:52)
Message:

Fix a missing type binding problem in tuple assignment

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Tuples/TupleAssignment.cc

    rb8baa37 r938dd75  
    281281        }
    282282
    283         // removes environments from subexpressions within statement exprs, which could throw off later passes like those in Box which rely on PolyMutator.
     283        // removes environments from subexpressions within statement exprs, which could throw off later passes like those in Box which rely on PolyMutator, and adds the bindings to the compositeEnv
    284284        // xxx - maybe this should happen in alternative finder for every StmtExpr?
    285         // xxx - it's possible that these environments could contain some useful information. Maybe the right thing to do is aggregate the environments and pass the aggregate back to be added into the compositeEnv
    286285        struct EnvRemover {
    287286                void previsit( ExprStmt * stmt ) {
    288                         delete stmt->expr->env;
    289                         stmt->expr->env = nullptr;
    290                 }
     287                        assert( compositeEnv );
     288                        if ( stmt->expr->env ) {
     289                                compositeEnv->add( *stmt->expr->env );
     290                                delete stmt->expr->env;
     291                                stmt->expr->env = nullptr;
     292                        }
     293                }
     294
     295                ResolvExpr::TypeEnvironment * compositeEnv = nullptr;
    291296        };
    292297
     
    300305                        ResolvExpr::resolveCtorInit( ctorInit, spotter.currentFinder.get_indexer() ); // resolve ctor/dtors for the new object
    301306                        PassVisitor<EnvRemover> rm; // remove environments from subexpressions of StmtExprs
     307                        rm.pass.compositeEnv = &compositeEnv;
    302308                        ctorInit->accept( rm );
    303309                }
Note: See TracChangeset for help on using the changeset viewer.