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