Changes in src/SynTree/AggregateDecl.cc [ac3362c:50377a4]
- File:
-
- 1 edited
-
src/SynTree/AggregateDecl.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/AggregateDecl.cc
rac3362c r50377a4 86 86 std::string TraitDecl::typeString() const { return "trait"; } 87 87 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 111 88 // Local Variables: // 112 89 // tab-width: 4 //
Note:
See TracChangeset
for help on using the changeset viewer.