Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/AggregateDecl.cc

    rac3362c r50377a4  
    8686std::string TraitDecl::typeString() const { return "trait"; }
    8787
    88 bool EnumDecl::valueOf( Declaration * enumerator, long long int & value ) {
    89         if ( enumValues.empty() ) {
    90                 long long int currentValue = 0;
    91                 for ( Declaration * member : members ) {
    92                         ObjectDecl * field = strict_dynamic_cast< ObjectDecl * >( member );
    93                         if ( field->init ) {
    94                                 SingleInit * init = strict_dynamic_cast< SingleInit * >( field->init );
    95                                 auto result = eval( init->value );
    96                                 if ( ! result.second ) SemanticError( init->location, toString( "Non-constexpr in initialization of enumerator: ", field ) );
    97                                 currentValue = result.first;
    98                         }
    99                         assertf( enumValues.count( field->name ) == 0, "Enum %s has multiple members with the name %s", name.c_str(), field->name.c_str() );
    100                         enumValues[ field->name ] = currentValue;
    101                         ++currentValue;
    102                 }
    103         }
    104         if ( enumValues.count( enumerator->name ) ) {
    105                 value = enumValues[ enumerator->name ];
    106                 return true;
    107         }
    108         return false;
    109 }
    110 
    11188// Local Variables: //
    11289// tab-width: 4 //
Note: See TracChangeset for help on using the changeset viewer.