Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CastCost.cc

    reb7586e r0bd3faf  
    5353                        } else {
    5454                                cost = conversionCost( basicType, dst, srcIsLvalue, symtab, env );
    55                                 if ( Cost::unsafe < cost ) {
    56                                         if (auto enumInst =  dynamic_cast<const ast::EnumInstType *>(dst)) {
    57                                                 assert(enumInst->base->base);
    58                                                 cost = Cost::unsafe;
    59                                         }
    60                                 }
    6155                        }
    62                 }
    63 
    64                 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 {
    70                         cost = conversionCost( zero, dst, srcIsLvalue, symtab, env );
    71                         if ( Cost::unsafe < cost ) {
    72                                 if (auto enumInst =  dynamic_cast<const ast::EnumInstType *>(dst)) {
    73                                         assert(enumInst->base->base);
    74                                         cost = Cost::unsafe;
    75                                 }
    76                         }
    77                         // }
    78                 }
    79 
    80                 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 {
    86                         cost = conversionCost( one, dst, srcIsLvalue, symtab, env );
    87                         if ( Cost::unsafe < cost ) {
    88                                 if (auto enumInst =  dynamic_cast<const ast::EnumInstType *>(dst)) {
    89                                         assert(enumInst->base->base);
    90                                         cost = Cost::unsafe;
    91                                 }
    92                         }
    93                         // }
    9456                }
    9557
     
    11880                                        cost = Cost::unsafe;
    11981                                }
    120                         }
    121                 }
    122 
    123                 void postvist( const ast::EnumInstType * ) {
    124                         if ( auto basic = dynamic_cast< const ast::BasicType * >(dst) ) {
    125                                 if ( basic->isInteger() ) cost = Cost::unsafe;
    12682                        }
    12783                }
Note: See TracChangeset for help on using the changeset viewer.