Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    r906e24d rb6fe7e6  
    391391                                CP_CTOR_PRINT( std::cerr << "Type Substitution: " << *impCpCtorExpr->get_env() << std::endl; )
    392392                                // xxx - need to handle tuple arguments
    393                                 assert( arg->has_result() );
    394                                 Type * result = arg->get_result();
     393                                assert( ! arg->get_results().empty() );
     394                                Type * result = arg->get_results().front();
    395395                                if ( skipCopyConstruct( result ) ) continue; // skip certain non-copyable types
    396396                                // type may involve type variables, so apply type substitution to get temporary variable's actual type
     
    423423                        // level. Trying to pass that environment along.
    424424                        callExpr->set_env( impCpCtorExpr->get_env()->clone() );
    425                         Type * result = appExpr->get_result();
    426                         if ( ! result->isVoid() ) {
    427                                 // need to flatten result type and construct each
     425                        for ( Type * result : appExpr->get_results() ) {
    428426                                result = result->clone();
    429427                                impCpCtorExpr->get_env()->apply( result );
     
    481479                                // know the result type of the assignment is the type of the LHS (minus the pointer), so
    482480                                // add that onto the assignment expression so that later steps have the necessary information
    483                                 assign->set_result( returnDecl->get_type()->clone() );
     481                                assign->add_result( returnDecl->get_type()->clone() );
    484482
    485483                                Expression * retExpr = new CommaExpr( assign, new VariableExpr( returnDecl ) );
    486                                 if ( callExpr->get_result()->get_isLvalue() ) {
     484                                if ( callExpr->get_results().front()->get_isLvalue() ) {
    487485                                        // lvalue returning functions are funny. Lvalue.cc inserts a *? in front of any lvalue returning
    488486                                        // non-intrinsic function. Add an AddressExpr to the call to negate the derefence and change the
     
    502500                                        UntypedExpr * deref = new UntypedExpr( new NameExpr( "*?" ) );
    503501                                        deref->get_args().push_back( retExpr );
    504                                         deref->set_result( resultType );
     502                                        deref->add_result( resultType );
    505503                                        retExpr = deref;
    506504                                } // if
     
    941939                Expression * FixCtorExprs::mutate( ConstructorExpr * ctorExpr ) {
    942940                        static UniqueName tempNamer( "_tmp_ctor_expr" );
    943                         assert( ctorExpr->has_result() && ctorExpr->get_result()->size() == 1 );
    944                         ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, ctorExpr->get_result()->clone(), nullptr );
     941                        assert( ctorExpr->get_results().size() == 1 );
     942                        ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, ctorExpr->get_results().front()->clone(), nullptr );
    945943                        addDeclaration( tmp );
    946944
     
    954952                        assign->get_args().push_back( new VariableExpr( tmp ) );
    955953                        assign->get_args().push_back( firstArg );
    956                         assign->set_result( ctorExpr->get_result()->clone() );
     954                        cloneAll( ctorExpr->get_results(), assign->get_results() );
    957955                        firstArg = assign;
    958956
Note: See TracChangeset for help on using the changeset viewer.