Changeset 7f6a7c9 for src/Parser/DeclarationNode.cc
- Timestamp:
- Sep 21, 2022, 11:02:15 AM (3 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation
- Children:
- 95dab9e
- Parents:
- 428adbc (diff), 0bd46fd (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r428adbc r7f6a7c9 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jul 14 17:36:57 202113 // Update Count : 11 5412 // Last Modified On : Mon Aug 8 17:07:00 2022 13 // Update Count : 1185 14 14 // 15 15 … … 128 128 if ( name ) { 129 129 os << *name << ": "; 130 } else {131 os << "unnamed: ";132 130 } // if 133 131 … … 154 152 initializer->printOneLine( os ); 155 153 os << " maybe constructed? " << initializer->get_maybeConstructed(); 156 157 } // if 154 } // if 155 156 for ( Attribute * attr: reverseIterate( attributes ) ) { 157 os << string( indent + 2, ' ' ) << "attr " << attr->name.c_str(); 158 } // for 158 159 159 160 os << endl; … … 243 244 newnode->type = new TypeData( TypeData::Aggregate ); 244 245 newnode->type->aggregate.kind = kind; 245 newnode->type->aggregate.name = 246 newnode->type->aggregate.name = name == nullptr ? new string( DeclarationNode::anonymous.newName() ) : name; 246 247 newnode->type->aggregate.actuals = actuals; 247 248 newnode->type->aggregate.fields = fields; … … 253 254 } // DeclarationNode::newAggregate 254 255 255 DeclarationNode * DeclarationNode::newEnum( const string * name, DeclarationNode * constants, bool body, DeclarationNode * base) {256 DeclarationNode * DeclarationNode::newEnum( const string * name, DeclarationNode * constants, bool body, bool typed, DeclarationNode * base) { 256 257 DeclarationNode * newnode = new DeclarationNode; 257 258 newnode->type = new TypeData( TypeData::Enum ); … … 260 261 newnode->type->enumeration.body = body; 261 262 newnode->type->enumeration.anon = name == nullptr; 263 newnode->type->enumeration.typed = typed; 262 264 if ( base && base->type) { 263 newnode->type->base = base->type; 264 } // if 265 266 // Check: if base has TypeData 265 newnode->type->base = base->type; 266 } // if 267 267 268 return newnode; 268 269 } // DeclarationNode::newEnum … … 284 285 285 286 DeclarationNode * DeclarationNode::newEnumValueGeneric( const string * name, InitializerNode * init ) { 286 if ( init ) { // list init {} or a singleInit287 if ( init->get_expression() ) { // singleInit287 if ( init ) { 288 if ( init->get_expression() ) { 288 289 return newEnumConstant( name, init->get_expression() ); 289 } else { // TODO: listInit290 } else { 290 291 DeclarationNode * newnode = newName( name ); 291 292 newnode->initializer = init; … … 293 294 } // if 294 295 } else { 295 return newName( name ); // Not explicitly inited enum value;296 return newName( name ); 296 297 } // if 297 298 } // DeclarationNode::newEnumValueGeneric … … 504 505 } // for 505 506 // src is the new item being added and has a single bit 506 } else if ( ! src->storageClasses.is_threadlocal ) { // conflict ?507 } else if ( ! src->storageClasses.is_threadlocal_any() ) { // conflict ? 507 508 appendError( error, string( "conflicting " ) + Type::StorageClassesNames[storageClasses.ffs()] + 508 509 " & " + Type::StorageClassesNames[src->storageClasses.ffs()] ); … … 518 519 storageClasses |= q->storageClasses; 519 520 520 for ( Attribute * attr: reverseIterate( q->attributes ) ) {521 for ( Attribute * attr: reverseIterate( q->attributes ) ) { 521 522 attributes.push_front( attr->clone() ); 522 523 } // for … … 683 684 } // if 684 685 delete o; 686 685 687 return this; 686 688 }
Note:
See TracChangeset
for help on using the changeset viewer.