Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CastCost.cc

    rc333ed2 reb7586e  
    5454                                cost = conversionCost( basicType, dst, srcIsLvalue, symtab, env );
    5555                                if ( Cost::unsafe < cost ) {
    56                                         if (auto enumInst = dynamic_cast<const ast::EnumInstType *>(dst)) {
    57                                                 // Always explict cast only for typed enum
    58                                                 if (enumInst->base->isTyped) cost = Cost::unsafe;
     56                                        if (auto enumInst =  dynamic_cast<const ast::EnumInstType *>(dst)) {
     57                                                assert(enumInst->base->base);
     58                                                cost = Cost::unsafe;
    5959                                        }
    6060                                }
     
    6363
    6464                void postvisit( const ast::ZeroType * zero ) {
     65                        // auto ptr = dynamic_cast< const ast::PointerType * >( dst );
     66                        // if ( ptr && basicType->isInteger() ) {
     67                        //      // needed for, e.g. unsigned long => void *
     68                        //      cost = Cost::unsafe;
     69                        // } else {
    6570                        cost = conversionCost( zero, dst, srcIsLvalue, symtab, env );
    6671                        if ( Cost::unsafe < cost ) {
    6772                                if (auto enumInst =  dynamic_cast<const ast::EnumInstType *>(dst)) {
    68                                         if (enumInst->base->isTyped) cost = Cost::unsafe;
     73                                        assert(enumInst->base->base);
     74                                        cost = Cost::unsafe;
    6975                                }
    7076                        }
     77                        // }
    7178                }
    7279
    7380                void postvisit( const ast::OneType * one ) {
     81                        // auto ptr = dynamic_cast< const ast::PointerType * >( dst );
     82                        // if ( ptr && basicType->isInteger() ) {
     83                        //      // needed for, e.g. unsigned long => void *
     84                        //      cost = Cost::unsafe;
     85                        // } else {
    7486                        cost = conversionCost( one, dst, srcIsLvalue, symtab, env );
    7587                        if ( Cost::unsafe < cost ) {
    76                                 if (auto enumInst = dynamic_cast<const ast::EnumInstType *>(dst)) {
    77                                         if (enumInst->base->isTyped) cost = Cost::unsafe;
     88                                if (auto enumInst =  dynamic_cast<const ast::EnumInstType *>(dst)) {
     89                                        assert(enumInst->base->base);
     90                                        cost = Cost::unsafe;
    7891                                }
    7992                        }
     93                        // }
    8094                }
    8195
Note: See TracChangeset for help on using the changeset viewer.