Changes in src/SynTree/AggregateDecl.cc [ac3362c:0690350]
- File:
-
- 1 edited
-
src/SynTree/AggregateDecl.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/AggregateDecl.cc
rac3362c r0690350 86 86 std::string TraitDecl::typeString() const { return "trait"; } 87 87 88 namespace { 89 long long int getConstValue( Expression * expr ) { 90 if ( CastExpr * castExpr = dynamic_cast< CastExpr * > ( expr ) ) { 91 return getConstValue( castExpr->arg ); 92 } else if ( ConstantExpr * constExpr = dynamic_cast< ConstantExpr * >( expr ) ) { 93 return constExpr->intValue(); 94 // can be -1, +1, etc. 95 // } else if ( UntypedExpr * untypedExpr = dynamic_cast< UntypedExpr * >( expr ) ) { 96 // if ( untypedExpr-> ) 97 } else { 98 assertf( false, "Unhandled expression type in getConstValue for enumerators: %s", toString( expr ).c_str() ); 99 } 100 } 101 } 102 88 103 bool EnumDecl::valueOf( Declaration * enumerator, long long int & value ) { 89 104 if ( enumValues.empty() ) { … … 93 108 if ( field->init ) { 94 109 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; 110 currentValue = getConstValue( init->value ); 98 111 } 99 112 assertf( enumValues.count( field->name ) == 0, "Enum %s has multiple members with the name %s", name.c_str(), field->name.c_str() );
Note:
See TracChangeset
for help on using the changeset viewer.