Ignore:
Timestamp:
Oct 4, 2019, 3:07:07 PM (2 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast, new-ast-unique-expr
Children:
3f3bfe5a
Parents:
90ce35aa
Message:

Implemented expression based lvalue resolution on new ast.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CandidateFinder.cpp

    r90ce35aa rcf32116  
    99// Author           : Aaron B. Moss
    1010// Created On       : Wed Jun 5 14:30:00 2019
    11 // Last Modified By : Aaron B. Moss
    12 // Last Modified On : Wed Jun 5 14:30:00 2019
    13 // Update Count     : 1
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Tue Oct  1 14:55:00 2019
     13// Update Count     : 2
    1414//
    1515
     
    6262
    6363Cost computeConversionCost(
    64         const ast::Type * argType, const ast::Type * paramType, const ast::SymbolTable & symtab,
    65         const ast::TypeEnvironment & env
     64        const ast::Type * argType, const ast::Type * paramType, bool argIsLvalue,
     65        const ast::SymbolTable & symtab, const ast::TypeEnvironment & env
    6666) {
    6767        PRINT(
     
    7474                std::cerr << std::endl;
    7575        )
    76         Cost convCost = conversionCost( argType, paramType, symtab, env );
     76        Cost convCost = conversionCost( argType, paramType, argIsLvalue, symtab, env );
    7777        PRINT(
    7878                std::cerr << std::endl << "cost is " << convCost << std::endl;
     
    110110                const ast::Expr * arg, const ast::Type * paramType, const ast::SymbolTable & symtab, const ast::TypeEnvironment & env, Cost & outCost
    111111        ) {
    112                 Cost convCost = computeConversionCost( arg->result, paramType, symtab, env );
     112                Cost convCost = computeConversionCost(
     113                                arg->result, paramType, arg->get_lvalue(), symtab, env );
    113114                outCost += convCost;
    114115
     
    982983                /// true if expression is an lvalue
    983984                static bool isLvalue( const ast::Expr * x ) {
    984                         return x->result && ( x->result->is_lvalue() || x->result.as< ast::ReferenceType >() );
     985                        return x->result && ( x->get_lvalue() || x->result.as< ast::ReferenceType >() );
    985986                }
    986987
     
    10241025                                // unification run for side-effects
    10251026                                unify( toType, cand->expr->result, cand->env, need, have, open, symtab );
    1026                                 Cost thisCost = castCost( cand->expr->result, toType, symtab, cand->env );
     1027                                Cost thisCost = castCost( cand->expr->result, toType, cand->expr->get_lvalue(),
     1028                                                symtab, cand->env );
    10271029                                PRINT(
    10281030                                        std::cerr << "working on cast with result: " << toType << std::endl;
     
    14341436                                        // unification run for side-effects
    14351437                                        unify( toType, cand->expr->result, env, need, have, open, symtab );
    1436                                         Cost thisCost = castCost( cand->expr->result, toType, symtab, env );
     1438                                        Cost thisCost = castCost( cand->expr->result, toType, cand->expr->get_lvalue(),
     1439                                                        symtab, env );
    14371440
    14381441                                        if ( thisCost != Cost::infinity ) {
Note: See TracChangeset for help on using the changeset viewer.