Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CandidateFinder.cpp

    r90be0cf r16ba4897  
    21362136}
    21372137
    2138 /// If the target enum is a child, get the offset from the base to the target.
    2139 static unsigned findChildOffset(
    2140                 const ast::EnumDecl * decl, const ast::EnumDecl * target ) {
    2141         unsigned offset = 0;
    2142         for ( auto inlined : decl->inlinedDecl ) {
    2143                 auto childDecl = inlined->base;
    2144                 if ( childDecl == target ) {
    2145                         return offset;
    2146                 }
    2147                 offset += childDecl->members.size();
    2148         }
    2149         SemanticError( decl, "Cannot find the target enum." );
    2150 }
    2151 
    21522138const ast::Expr * CandidateFinder::makeEnumOffsetCast( const ast::EnumInstType * src,
    21532139        const ast::EnumInstType * dst, const ast::Expr * expr, Cost minCost ) {
     
    21612147                ast::CastExpr * castToDst;
    21622148                if (c<minCost) {
    2163                         unsigned offset = findChildOffset( dstDecl, dstChild.get()->base );
     2149                        unsigned offset = dstDecl->calChildOffset(dstChild.get());
    21642150                        if (offset > 0) {
    21652151                                auto untyped = ast::UntypedExpr::createCall(
    2166                                         expr->location,
    2167                                         "?+?",
     2152                                        expr->location, 
     2153                                        "?+?", 
    21682154                                        { new ast::CastExpr( expr->location,
    21692155                                                expr,
Note: See TracChangeset for help on using the changeset viewer.