Changeset 9058414


Ignore:
Timestamp:
Dec 18, 2017, 2:11:13 PM (4 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
7641b6c
Parents:
74cdfb1
Message:

Generate reference assignment for reference component of a tuple assignment

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Tuples/TupleAssignment.cc

    r74cdfb1 r9058414  
    272272                // args.push_back( new AddressExpr( new VariableExpr( left ) ) );
    273273                if ( right ) args.push_back( new VariableExpr( right ) );
    274                 return new UntypedExpr( new NameExpr( fname ), args );
     274                if ( left->type->referenceDepth() > 1 && CodeGen::isConstructor( fname ) ) {
     275                        args.front() = new AddressExpr( args.front() );
     276                        if ( right ) args.back() = new AddressExpr( args.back() );
     277                        return new UntypedExpr( new NameExpr( "?=?" ), args );
     278                } else {
     279                        return new UntypedExpr( new NameExpr( fname ), args );
     280                }
    275281        }
    276282
     
    291297                if ( ! dynamic_cast< ReferenceType * >( expr->get_result() ) ) {
    292298                        ConstructorInit * ctorInit = InitTweak::genCtorInit( ret );
    293                         ret->set_init( ctorInit );
     299                        ret->init = ctorInit;
    294300                        ResolvExpr::resolveCtorInit( ctorInit, spotter.currentFinder.get_indexer() ); // resolve ctor/dtors for the new object
    295301                        PassVisitor<EnvRemover> rm; // remove environments from subexpressions of StmtExprs
Note: See TracChangeset for help on using the changeset viewer.