Changeset 99f7f37


Ignore:
Timestamp:
Jul 4, 2024, 1:47:46 AM (3 days ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
8c55d34
Parents:
f8f298c
Message:

Fix the bug that enum {} var syntax cannot be recognized as cfa enum

Location:
src/Parser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cpp

    rf8f298c r99f7f37  
    185185} // DeclarationNode::newAggregate
    186186
    187 DeclarationNode * DeclarationNode::newEnum( const string * name, DeclarationNode * constants, bool body, bool typed, DeclarationNode * base, EnumHiding hiding ) {
     187DeclarationNode * DeclarationNode::newEnum( const string * name, DeclarationNode * constants, bool body, bool isCfa, DeclarationNode * base, EnumHiding hiding ) {
    188188        DeclarationNode * newnode = newAggregate( ast::AggregateDecl::Enum, name, nullptr, constants, body );
    189         newnode->type->aggregate.typed = typed;
     189        newnode->type->aggregate.isCfa = isCfa;
    190190        newnode->type->aggregate.hiding = hiding;
    191191        if ( base ) {
    192                 assert( typed );
     192                assert( isCfa );
    193193                assert( base->type );
    194194                newnode->type->base = base->type;
     
    541541        newaggr->aggregate.body = false;
    542542        newaggr->aggregate.anon = oldaggr->aggregate.anon;
    543         newaggr->aggregate.typed = oldaggr->aggregate.typed;
     543        newaggr->aggregate.isCfa = oldaggr->aggregate.isCfa;
    544544        newaggr->aggregate.hiding = oldaggr->aggregate.hiding;
    545545        swap( newaggr, oldaggr );
  • src/Parser/TypeData.cpp

    rf8f298c r99f7f37  
    8484                aggregate.body = false;
    8585                aggregate.anon = false;
    86                 aggregate.typed = false;
     86                aggregate.isCfa = false;
    8787                aggregate.hiding = EnumHiding::Visible;
    8888                break;
     
    218218                newtype->aggregate.body = aggregate.body;
    219219                newtype->aggregate.anon = aggregate.anon;
     220                newtype->aggregate.isCfa = aggregate.isCfa;
     221                newtype->aggregate.hiding = aggregate.hiding;
    220222                break;
    221223        case AggregateInst:
     
    14561458                td->location,
    14571459                *td->aggregate.name,
    1458                 td->aggregate.typed,
     1460                td->aggregate.isCfa,
    14591461                std::move( attributes ),
    14601462                linkage,
  • src/Parser/TypeData.hpp

    rf8f298c r99f7f37  
    6060                // Is this type anonymous? (Name can still be set to generated name.)
    6161                bool anon;
    62                 // Is this a typed enumeration? Type may be stored in base.
    63                 bool typed;
     62                // Is this a cfa enumeration? Type stored in base.
     63                bool isCfa;
    6464                EnumHiding hiding;
    6565        };
Note: See TracChangeset for help on using the changeset viewer.