Ignore:
Timestamp:
Jun 10, 2024, 2:43:13 AM (2 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
42cdd07d
Parents:
d68de59
Message:
  1. Implement enum cast; 2. Change valueE so that opague enum returns quasi_void; 3. change enum hiding interpretation and pass visiting scheme
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CastCost.cpp

    rd68de59 r85855b0  
    3636namespace ResolvExpr {
    3737
     38Cost castCost(
     39        const ast::Type * src, const ast::Type * dst, bool srcIsLvalue,
     40        const ast::SymbolTable & symtab, const ast::TypeEnvironment & env
     41);
     42
    3843namespace {
    3944        struct CastCost : public ConversionCost {
     
    4550                        const ast::TypeEnvironment & env, CostCalculation costFunc )
    4651                : ConversionCost( dst, srcIsLvalue, symtab, env, costFunc ) {}
     52
     53                void postvisit( const ast::EnumInstType * enumInst ) {
     54                        cost = conversionCost( enumInst, dst, srcIsLvalue, symtab, env );
     55                }
    4756
    4857                void postvisit( const ast::BasicType * basicType ) {
     
    104113                                        cost = Cost::unsafe;
    105114                                }
    106                         }
    107                 }
    108 
    109                 void postvist( const ast::EnumInstType * ) {
    110                         if ( auto basic = dynamic_cast< const ast::BasicType * >(dst) ) {
    111                                 if ( basic->isInteger() ) cost = Cost::unsafe;
    112115                        }
    113116                }
Note: See TracChangeset for help on using the changeset viewer.