Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    rb6fe7e6 r906e24d  
    391391                                CP_CTOR_PRINT( std::cerr << "Type Substitution: " << *impCpCtorExpr->get_env() << std::endl; )
    392392                                // xxx - need to handle tuple arguments
    393                                 assert( ! arg->get_results().empty() );
    394                                 Type * result = arg->get_results().front();
     393                                assert( arg->has_result() );
     394                                Type * result = arg->get_result();
    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                         for ( Type * result : appExpr->get_results() ) {
     425                        Type * result = appExpr->get_result();
     426                        if ( ! result->isVoid() ) {
     427                                // need to flatten result type and construct each
    426428                                result = result->clone();
    427429                                impCpCtorExpr->get_env()->apply( result );
     
    479481                                // know the result type of the assignment is the type of the LHS (minus the pointer), so
    480482                                // add that onto the assignment expression so that later steps have the necessary information
    481                                 assign->add_result( returnDecl->get_type()->clone() );
     483                                assign->set_result( returnDecl->get_type()->clone() );
    482484
    483485                                Expression * retExpr = new CommaExpr( assign, new VariableExpr( returnDecl ) );
    484                                 if ( callExpr->get_results().front()->get_isLvalue() ) {
     486                                if ( callExpr->get_result()->get_isLvalue() ) {
    485487                                        // lvalue returning functions are funny. Lvalue.cc inserts a *? in front of any lvalue returning
    486488                                        // non-intrinsic function. Add an AddressExpr to the call to negate the derefence and change the
     
    500502                                        UntypedExpr * deref = new UntypedExpr( new NameExpr( "*?" ) );
    501503                                        deref->get_args().push_back( retExpr );
    502                                         deref->add_result( resultType );
     504                                        deref->set_result( resultType );
    503505                                        retExpr = deref;
    504506                                } // if
     
    939941                Expression * FixCtorExprs::mutate( ConstructorExpr * ctorExpr ) {
    940942                        static UniqueName tempNamer( "_tmp_ctor_expr" );
    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 );
     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 );
    943945                        addDeclaration( tmp );
    944946
     
    952954                        assign->get_args().push_back( new VariableExpr( tmp ) );
    953955                        assign->get_args().push_back( firstArg );
    954                         cloneAll( ctorExpr->get_results(), assign->get_results() );
     956                        assign->set_result( ctorExpr->get_result()->clone() );
    955957                        firstArg = assign;
    956958
Note: See TracChangeset for help on using the changeset viewer.