Ignore:
Timestamp:
Nov 10, 2021, 7:21:57 PM (2 years ago)
Author:
Fangren Yu <f37yu@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
f95634e
Parents:
01d433e
Message:

fix unique expr pass

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Tuples/TupleExpansionNew.cpp

    r01d433e rbb9924c  
    2222        struct UniqueExprExpander final : public ast::WithDeclsToAdd<> {
    2323                const ast::Expr * postvisit( const ast::UniqueExpr * unqExpr );
    24                 std::map< int, const ast::Expr * > decls; // not vector, because order added may not be increasing order
     24                std::map< int, ast::ptr<ast::Expr> > decls; // not vector, because order added may not be increasing order
    2525        };
    2626} // namespace
     
    3939                if ( ! decls.count( id ) ) {
    4040                        ast::ptr< ast::Expr > assignUnq;
    41                         ast::ptr< ast::VariableExpr > var = unqExpr->var;
     41                        const ast::VariableExpr * var = unqExpr->var;
    4242                        if ( unqExpr->object ) {
    4343                                // an object was generated to represent this unique expression -- it should be added to the list of declarations now
    4444                                declsToAddBefore.push_back( unqExpr->object.as< ast::Decl >() );
    4545                                // deep copy required due to unresolved issues with UniqueExpr
    46                                 assignUnq = ast::UntypedExpr::createAssign( loc, var, ast::deepCopy( unqExpr->expr.get() ) );
     46                                assignUnq = ast::UntypedExpr::createAssign( loc, var, unqExpr->expr );
    4747                        } else {
    48                                 ast::ptr< ast::Expr > expr = unqExpr->expr;
    49                                 ast::ptr< ast::CommaExpr > commaExpr = expr.strict_as< ast::CommaExpr >();
     48                                const auto commaExpr = unqExpr->expr.strict_as< ast::CommaExpr >();
    5049                                assignUnq = commaExpr->arg1;
    5150                        }
     
    6463                }
    6564                //delete unqExpr;
    66                 return decls[id];
     65                return ast::deepCopy(decls[id].get());
    6766        }
    6867} // namespace
Note: See TracChangeset for help on using the changeset viewer.