Changeset 3e54399 for src/AST/Decl.cpp


Ignore:
Timestamp:
Mar 10, 2022, 2:03:43 AM (2 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
f238fcc2
Parents:
786c438
Message:

The compiler now will add a cast to base type for the usage of type enum; but it will fail because of violating some restrictions for the auto-gen functions. Need to investiage more

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Decl.cpp

    r786c438 r3e54399  
    137137                       
    138138                // Handle typed enum by casting the value in (C++) compiler
    139                 if ( base ) { // A typed enum
    140                         if ( const BasicType * bt = dynamic_cast<const BasicType *>(base) ) {
    141                                 switch( bt->kind ) {
    142                                         case BasicType::Kind::Bool:     value = (bool) it->second; break;
    143                                         case BasicType::Kind::Char: value = (char) it->second; break;
    144                                         case BasicType::Kind::SignedChar: value = (signed char) it->second; break;
    145                                         case BasicType::Kind::UnsignedChar: value = (unsigned char) it->second; break;
    146                                         case BasicType::Kind::ShortSignedInt: value = (short signed int) it->second; break;
    147                                         case BasicType::Kind::SignedInt: value = (signed int) it->second; break;
    148                                         case BasicType::Kind::UnsignedInt: value = (unsigned int) it->second; break;
    149                                         case BasicType::Kind::LongSignedInt: value = (long signed int) it->second; break;
    150                                         case BasicType::Kind::LongUnsignedInt: value = (long unsigned int) it->second; break;
    151                                         case BasicType::Kind::LongLongSignedInt: value = (long long signed int) it->second; break;
    152                                         case BasicType::Kind::LongLongUnsignedInt: value = (long long unsigned int) it->second; break;
    153                                         // TODO: value should be able to handle long long unsigned int
     139                // if ( base ) { // A typed enum
     140                //      if ( const BasicType * bt = dynamic_cast<const BasicType *>(base) ) {
     141                //              switch( bt->kind ) {
     142                //                      case BasicType::Kind::Bool:     value = (bool) it->second; break;
     143                //                      case BasicType::Kind::Char: value = (char) it->second; break;
     144                //                      case BasicType::Kind::SignedChar: value = (signed char) it->second; break;
     145                //                      case BasicType::Kind::UnsignedChar: value = (unsigned char) it->second; break;
     146                //                      case BasicType::Kind::ShortSignedInt: value = (short signed int) it->second; break;
     147                //                      case BasicType::Kind::SignedInt: value = (signed int) it->second; break;
     148                //                      case BasicType::Kind::UnsignedInt: value = (unsigned int) it->second; break;
     149                //                      case BasicType::Kind::LongSignedInt: value = (long signed int) it->second; break;
     150                //                      case BasicType::Kind::LongUnsignedInt: value = (long unsigned int) it->second; break;
     151                //                      case BasicType::Kind::LongLongSignedInt: value = (long long signed int) it->second; break;
     152                //                      case BasicType::Kind::LongLongUnsignedInt: value = (long long unsigned int) it->second; break;
     153                //                      // TODO: value should be able to handle long long unsigned int
    154154
    155                                         default:
    156                                         value = it->second;
    157                                 }
    158                         }
    159                 } else {
     155                //                      default:
     156                //                      value = it->second;
     157                //              }
     158                //      }
     159                // } else {
    160160                        value = it->second;
    161                 }
     161                //}
    162162
    163163                return true;
Note: See TracChangeset for help on using the changeset viewer.