Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/ConversionCost.h

    r1d17939 re6b42e7  
    7272
    7373// Some function pointer types, differ in return type.
    74 using CostCalculation = std::function<Cost(const ast::Type *, const ast::Type *,
     74using CostCalculation = std::function<Cost(const ast::Type *, const ast::Type *, bool,
    7575        const ast::SymbolTable &, const ast::TypeEnvironment &)>;
    76 using NumCostCalculation = std::function<int(const ast::Type *, const ast::Type *,
     76using PtrsCalculation = std::function<int(const ast::Type *, const ast::Type *,
    7777        const ast::SymbolTable &, const ast::TypeEnvironment &)>;
    7878
     
    8181protected:
    8282        const ast::Type * dst;
     83        bool srcIsLvalue;
    8384        const ast::SymbolTable & symtab;
    8485        const ast::TypeEnvironment & env;
    8586        CostCalculation costCalc;
    8687public:
     88        static size_t traceId;
    8789        Cost cost;
     90        Cost result() { return cost; }
    8891
    89         ConversionCost_new( const ast::Type * dst, const ast::SymbolTable & symtab,
     92        ConversionCost_new( const ast::Type * dst, bool srcIsLvalue, const ast::SymbolTable & symtab,
    9093                        const ast::TypeEnvironment & env, CostCalculation costCalc ) :
    91                 dst( dst ), symtab( symtab ), env( env ), costCalc( costCalc ), cost( Cost::infinity )
     94                dst( dst ), srcIsLvalue( srcIsLvalue ), symtab( symtab ), env( env ),
     95                costCalc( costCalc ), cost( Cost::infinity )
    9296        {}
    9397
     
    110114
    111115Cost convertToReferenceCost( const ast::Type * src, const ast::ReferenceType * dest,
    112         const ast::SymbolTable & indexer, const ast::TypeEnvironment & env, NumCostCalculation func );
     116        bool srcIsLvalue, const ast::SymbolTable & indexer, const ast::TypeEnvironment & env,
     117        PtrsCalculation func );
    113118
    114119} // namespace ResolvExpr
Note: See TracChangeset for help on using the changeset viewer.