Changeset 057608a
- Timestamp:
- Mar 18, 2024, 5:44:22 PM (8 months ago)
- Branches:
- master
- Children:
- 5b25c49
- Parents:
- 8f650f0
- Location:
- src/Parser
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r8f650f0 r057608a 185 185 newnode->type->aggregate.fields = fields; 186 186 newnode->type->aggregate.body = body; 187 newnode->type->aggregate.tagged = false;188 187 newnode->type->aggregate.parent = nullptr; 189 188 return newnode; … … 199 198 newnode->type->enumeration.typed = typed; 200 199 newnode->type->enumeration.hiding = hiding; 201 if ( base && base->type ) { 200 if ( base ) { 201 assert( typed ); 202 assert( base->type ); 202 203 newnode->type->base = base->type; 204 base->type = nullptr; 205 delete base; 203 206 } // if 204 207 … … 220 223 221 224 DeclarationNode * DeclarationNode::newEnumValueGeneric( const string * name, InitializerNode * init ) { 222 if ( init ) { 223 if ( init->get_expression() ) { 224 return newEnumConstant( name, init->get_expression() ); 225 } else { 226 DeclarationNode * newnode = newName( name ); 227 newnode->initializer = init; 228 return newnode; 229 } // if 225 if ( nullptr == init ) { 226 return newName( name ); 227 } else if ( init->get_expression() ) { 228 return newEnumConstant( name, init->get_expression() ); 230 229 } else { 231 return newName( name ); 230 DeclarationNode * newnode = newName( name ); 231 newnode->initializer = init; 232 return newnode; 232 233 } // if 233 234 } // DeclarationNode::newEnumValueGeneric … … 549 550 newaggr->aggregate.body = false; 550 551 newaggr->aggregate.anon = oldaggr->aggregate.anon; 551 newaggr->aggregate.tagged = oldaggr->aggregate.tagged;552 552 swap( newaggr, oldaggr ); 553 553 … … 596 596 } 597 597 598 // Wrap the declaration in a typedef. It actually does that by modifying the 599 // existing declaration, and may split it into two declarations. 600 // This only happens if the wrapped type is actually a declaration of a SUE 601 // type. If it does, the DeclarationNode for the SUE declaration is the node 602 // returned, make sure later transformations are applied to the right node. 598 603 DeclarationNode * DeclarationNode::addTypedef() { 599 604 TypeData * newtype = new TypeData( TypeData::Symbolic ); -
src/Parser/TypeData.cc
r8f650f0 r057608a 88 88 aggregate.fields = nullptr; 89 89 aggregate.body = false; 90 aggregate.tagged = false;91 90 aggregate.parent = nullptr; 92 91 aggregate.anon = false; … … 228 227 newtype->aggregate.body = aggregate.body; 229 228 newtype->aggregate.anon = aggregate.anon; 230 newtype->aggregate.tagged = aggregate.tagged;231 229 break; 232 230 case AggregateInst: -
src/Parser/TypeData.h
r8f650f0 r057608a 55 55 bool body; 56 56 bool anon; 57 bool tagged;58 57 }; 59 58
Note: See TracChangeset
for help on using the changeset viewer.