Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Tuples/Explode.h

    r75308bcc r490ff5c3  
    2727namespace SymTab {
    2828class Indexer;
    29 }  // namespace SymTabf
     29}  // namespace SymTab
    3030
    3131namespace Tuples {
     
    6767                                for ( ResolvExpr::Alternative & alt : alts ) {
    6868                                        // distribute reference cast over all components
    69                                         append( std::forward<Output>(out), distributeReference( alt.expr ),
     69                                        append( std::forward<Output>(out), distributeReference( alt.release_expr() ),
    7070                                                alt.env, alt.cost, alt.cvtCost );
    7171                                }
     
    8484                                // tuple type, but not tuple expr - recursively index into its components.
    8585                                // if expr type is reference, convert to value type
    86                                 Expression * arg = expr;
     86                                Expression * arg = expr->clone();
    8787                                if ( Tuples::maybeImpureIgnoreUnique( arg ) ) {
    8888                                        // expressions which may contain side effects require a single unique instance of the expression.
     
    9494                                }
    9595                                for ( unsigned int i = 0; i < tupleType->size(); i++ ) {
    96                                         TupleIndexExpr * idx = new TupleIndexExpr( arg, i );
     96                                        TupleIndexExpr * idx = new TupleIndexExpr( arg->clone(), i );
    9797                                        explodeUnique( idx, alt, indexer, std::forward<Output>(out), isTupleAssign );
     98                                        delete idx;
    9899                                }
     100                                delete arg;
    99101                        }
    100102                } else {
    101                         // atomic (non-tuple) type - output the expression in a new alternative
    102                         append( std::forward<Output>(out), expr, alt.env, alt.cost, alt.cvtCost );
     103                        // atomic (non-tuple) type - output a clone of the expression in a new alternative
     104                        append( std::forward<Output>(out), expr->clone(), alt.env, alt.cost, alt.cvtCost );
    103105                }
    104106        }
Note: See TracChangeset for help on using the changeset viewer.