Changeset 85855b0 for src/Parser
- Timestamp:
- Jun 10, 2024, 2:43:13 AM (4 weeks ago)
- Branches:
- master
- Children:
- 42cdd07d
- Parents:
- d68de59
- Location:
- src/Parser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/TypeData.cpp
rd68de59 r85855b0 1465 1465 ret->hide = td->aggregate.hiding == EnumHiding::Hide ? ast::EnumDecl::EnumHiding::Hide : ast::EnumDecl::EnumHiding::Visible; 1466 1466 for ( const DeclarationNode * cur = td->aggregate.fields ; cur != nullptr ; cur = cur->next, ++members ) { 1467 if ( cur->enumInLine ) { 1468 // Do Nothing 1469 } else if ( ret->isTyped && !ret->base && cur->has_enumeratorValue() ) { 1467 if (cur->enumInLine) continue; 1468 ast::Decl * member = members->get_and_mutate(); 1469 ast::ObjectDecl * object = strict_dynamic_cast<ast::ObjectDecl *>( member ); 1470 object->isHidden = ast::EnumDecl::EnumHiding::Hide == ret->hide; 1471 if ( ret->isTyped && !ret->base && cur->has_enumeratorValue() ) { 1470 1472 SemanticError( td->location, "Enumerator of enum(void) cannot have an explicit initializer value." ); 1471 1473 } else if ( cur->has_enumeratorValue() ) { 1472 ast::Decl * member = members->get_and_mutate();1473 ast::ObjectDecl * object = strict_dynamic_cast<ast::ObjectDecl *>( member );1474 1474 object->init = new ast::SingleInit( 1475 1475 td->location, … … 1477 1477 ast::NoConstruct 1478 1478 ); 1479 } else if ( !cur->initializer ) { 1480 if ( baseType && (!dynamic_cast<ast::BasicType *>(baseType) || !dynamic_cast<ast::BasicType *>(baseType)->isInteger())) { 1481 SemanticError( td->location, "Enumerators of an non-integer typed enum must be explicitly initialized." ); 1482 } 1483 } 1479 } 1484 1480 // else cur is a List Initializer and has been set as init in buildList() 1485 1481 // if -
src/Parser/parser.yy
rd68de59 r85855b0 2827 2827 | enumerator_list ',' visible_hide_opt identifier_or_type_name enumerator_value_opt 2828 2828 { $$ = $1->set_last( DeclarationNode::newEnumValueGeneric( $4, $5 ) ); } 2829 | enumerator_list ',' INLINE type_name enumerator_value_opt2830 { $$ = $1->set_last( DeclarationNode::newEnum ValueGeneric( new string("inline"), nullptr )); }2829 | enumerator_list ',' INLINE type_name 2830 { $$ = $1->set_last( DeclarationNode::newEnumInLine( $4->symbolic.name ) ); } 2831 2831 ; 2832 2832
Note: See TracChangeset
for help on using the changeset viewer.