Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/ConversionCost.cc

    re874605 ref1da0e2  
    340340                } else if ( const EnumInstType * enumInst = dynamic_cast< const EnumInstType * >( dest ) ) {
    341341                        const EnumDecl * base_enum = enumInst->baseEnum;
    342                         if ( const Type * base = base_enum->base ) {
     342                        if ( const Type * base = base_enum->base ) { // if the base enum has a base (if it is typed)
    343343                                if ( const BasicType * enumBaseAstBasic = dynamic_cast< const BasicType *> (base) ) {
    344344                                        conversionCostFromBasicToBasic(basicType, enumBaseAstBasic);
     
    634634        } else if ( const ast::EnumInstType * enumInst = dynamic_cast< const ast::EnumInstType * >( dst ) ) {
    635635                const ast::EnumDecl * enumDecl = enumInst->base.get();
    636                 if ( enumDecl->isTyped && !enumDecl->base.get() ) {
    637                         cost = Cost::infinity;
    638                 } else if ( const ast::Type * enumType = enumDecl->base.get() ) {
     636                if ( const ast::Type * enumType = enumDecl->base.get() ) {
    639637                        if ( const ast::BasicType * enumTypeAsBasic = dynamic_cast<const ast::BasicType *>(enumType) ) {
    640638                                conversionCostFromBasicToBasic( basicType, enumTypeAsBasic );
     
    718716        const ast::EnumDecl * baseEnum = enumInstType->base;
    719717        if ( const ast::Type * baseType = baseEnum->base ) {
    720                 costCalc( baseType, dst, srcIsLvalue, symtab, env );
     718                cost = costCalc( baseType, dst, srcIsLvalue, symtab, env );
    721719        } else {
     720                (void)enumInstType;
    722721                static ast::ptr<ast::BasicType> integer = { new ast::BasicType( ast::BasicType::SignedInt ) };
    723722                cost = costCalc( integer, dst, srcIsLvalue, symtab, env );
Note: See TracChangeset for help on using the changeset viewer.