Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CandidateFinder.cpp

    rc92bdcc rb2ea0cd  
    1717
    1818#include <deque>
    19 #include <iterator>                 // for back_inserter
     19#include <iterator>               // for back_inserter
    2020#include <sstream>
    2121#include <string>
     
    2525#include "AdjustExprType.hpp"
    2626#include "Candidate.hpp"
    27 #include "CastCost.hpp"             // for castCost
     27#include "CastCost.hpp"           // for castCost
    2828#include "CompilationState.hpp"
    29 #include "ConversionCost.hpp"       // for conversionCast
    30 #include "Cost.hpp"
     29#include "ConversionCost.h"       // for conversionCast
     30#include "Cost.h"
    3131#include "ExplodedArg.hpp"
    3232#include "PolyCost.hpp"
    33 #include "RenameVars.hpp"           // for renameTyVars
    34 #include "Resolver.hpp"
    35 #include "ResolveTypeof.hpp"
     33#include "RenameVars.h"           // for renameTyVars
     34#include "Resolver.h"
     35#include "ResolveTypeof.h"
    3636#include "SatisfyAssertions.hpp"
    3737#include "SpecCost.hpp"
    38 #include "Typeops.hpp"              // for combos
    39 #include "Unify.hpp"
    40 #include "WidenMode.hpp"
     38#include "typeops.h"              // for combos
     39#include "Unify.h"
     40#include "WidenMode.h"
    4141#include "AST/Expr.hpp"
    4242#include "AST/Node.hpp"
     
    4545#include "AST/SymbolTable.hpp"
    4646#include "AST/Type.hpp"
    47 #include "Common/Utility.hpp"       // for move, copy
    48 #include "SymTab/Mangler.hpp"
    49 #include "Tuples/Tuples.hpp"        // for handleTupleAssignment
    50 #include "InitTweak/InitTweak.hpp"  // for getPointerBase
    51 
    52 #include "Common/Stats/Counter.hpp"
     47#include "Common/utility.h"       // for move, copy
     48#include "SymTab/Mangler.h"
     49#include "Tuples/Tuples.h"        // for handleTupleAssignment
     50#include "InitTweak/InitTweak.h"  // for getPointerBase
     51
     52#include "Common/Stats/Counter.h"
    5353
    5454#include "AST/Inspect.hpp"             // for getFunctionName
     
    21382138}
    21392139
     2140// get the valueE(...) ApplicationExpr that returns the enum value
     2141const ast::Expr * getValueEnumCall(
     2142        const ast::Expr * expr,
     2143        const ResolvExpr::ResolveContext & context, const ast::TypeEnvironment & env ) {
     2144                auto callExpr = new ast::UntypedExpr(
     2145                        expr->location, new ast::NameExpr( expr->location, "valueE"), {expr} );
     2146                CandidateFinder finder( context, env );
     2147                finder.find( callExpr );
     2148                CandidateList winners = findMinCost( finder.candidates );
     2149                if (winners.size() != 1) {
     2150                        SemanticError( callExpr, "Ambiguous expression in valueE..." );
     2151                }
     2152                CandidateRef & choice = winners.front();
     2153                return choice->expr;
     2154}
     2155
    21402156const ast::Expr * createCondExpr( const ast::Expr * expr ) {
    21412157        assert( expr );
Note: See TracChangeset for help on using the changeset viewer.