Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AlternativeFinder.cc

    rcc4218f r7d01cf44  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sat May 16 23:52:08 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 25 22:37:46 2019
    13 // Update Count     : 37
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thu Aug  8 16:35:00 2019
     13// Update Count     : 38
    1414//
    1515
     
    377377        }
    378378
    379         Cost computeConversionCost( Type * actualType, Type * formalType, const SymTab::Indexer &indexer, const TypeEnvironment & env ) {
     379        Cost computeConversionCost( Type * actualType, Type * formalType, bool actualIsLvalue,
     380                        const SymTab::Indexer &indexer, const TypeEnvironment & env ) {
    380381                PRINT(
    381382                        std::cerr << std::endl << "converting ";
     
    387388                        std::cerr << std::endl;
    388389                )
    389                 Cost convCost = conversionCost( actualType, formalType, indexer, env );
     390                Cost convCost = conversionCost( actualType, formalType, actualIsLvalue, indexer, env );
    390391                PRINT(
    391392                        std::cerr << std::endl << "cost is " << convCost << std::endl;
     
    402403
    403404        Cost computeExpressionConversionCost( Expression *& actualExpr, Type * formalType, const SymTab::Indexer &indexer, const TypeEnvironment & env ) {
    404                 Cost convCost = computeConversionCost( actualExpr->result, formalType, indexer, env );
     405                Cost convCost = computeConversionCost(
     406                        actualExpr->result, formalType, actualExpr->get_lvalue(), indexer, env );
    405407
    406408                // if there is a non-zero conversion cost, ignoring poly cost, then the expression requires conversion.
     
    11351137        bool isLvalue( Expression *expr ) {
    11361138                // xxx - recurse into tuples?
    1137                 return expr->result && ( expr->result->get_lvalue() || dynamic_cast< ReferenceType * >( expr->result ) );
     1139                return expr->result && ( expr->get_lvalue() || dynamic_cast< ReferenceType * >( expr->result ) );
    11381140        }
    11391141
     
    11861188                assert( toType );
    11871189                toType = resolveTypeof( toType, indexer );
    1188                 assert(!dynamic_cast<TypeofType *>(toType));
    11891190                SymTab::validateType( toType, &indexer );
    11901191                adjustExprType( toType, env, indexer );
     
    12131214                        unify( castExpr->result, alt.expr->result, alt.env, needAssertions,
    12141215                                haveAssertions, openVars, indexer );
    1215                         Cost thisCost = castCost( alt.expr->result, castExpr->result, indexer,
    1216                                 alt.env );
     1216                        Cost thisCost = castCost( alt.expr->result, castExpr->result, alt.expr->get_lvalue(),
     1217                                indexer, alt.env );
    12171218                        PRINT(
    12181219                                std::cerr << "working on cast with result: " << castExpr->result << std::endl;
     
    16411642                                // xxx - do some inspecting on this line... why isn't result bound to initAlt.type?
    16421643
    1643                                 Cost thisCost = castCost( alt.expr->result, toType, indexer, newEnv );
     1644                                Cost thisCost = castCost( alt.expr->result, toType, alt.expr->get_lvalue(),
     1645                                        indexer, newEnv );
    16441646                                if ( thisCost != Cost::infinity ) {
    16451647                                        // count one safe conversion for each value that is thrown away
Note: See TracChangeset for help on using the changeset viewer.