Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r3a5131ed rca1a547  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 16 13:06:50 2017
    13 // Update Count     : 753
     12// Last Modified On : Thu Feb 23 15:45:02 2017
     13// Update Count     : 759
    1414//
    1515
     
    174174        } // if
    175175
    176         if ( body ) {
    177                 newnode->type->function.hasBody = true;
    178         } // if
    179 
    180176        if ( ret ) {
    181177                newnode->type->base = ret->type;
     
    259255} // DeclarationNode::newAggregate
    260256
    261 DeclarationNode * DeclarationNode::newEnum( string * name, DeclarationNode * constants ) {
     257DeclarationNode * DeclarationNode::newEnum( string * name, DeclarationNode * constants, bool body ) {
    262258        DeclarationNode * newnode = new DeclarationNode;
    263259        newnode->type = new TypeData( TypeData::Enum );
     
    268264        } // if
    269265        newnode->type->enumeration.constants = constants;
     266        newnode->type->enumeration.body = body;
    270267        return newnode;
    271268} // DeclarationNode::newEnum
     
    698695        assert( ! type->function.body );
    699696        type->function.body = body;
    700         type->function.hasBody = true;
    701697        return this;
    702698}
     
    10401036        switch ( type->kind ) {
    10411037          case TypeData::Enum: {
    1042                   EnumDecl * typedecl = buildEnum( type, attributes );
    1043                   return new EnumInstType( buildQualifiers( type ), typedecl );
     1038                  if ( type->enumeration.body ) {
     1039                          EnumDecl * typedecl = buildEnum( type, attributes );
     1040                          return new EnumInstType( buildQualifiers( type ), typedecl );
     1041                  } else {
     1042                          return new EnumInstType( buildQualifiers( type ), *type->enumeration.name );
     1043                  }
    10441044          }
    10451045          case TypeData::Aggregate: {
    1046                   AggregateDecl * typedecl = buildAggregate( type, attributes );
    10471046                  ReferenceToType * ret;
    1048                   switch ( type->aggregate.kind ) {
    1049                         case DeclarationNode::Struct:
    1050                           ret = new StructInstType( buildQualifiers( type ), (StructDecl *)typedecl );
    1051                           break;
    1052                         case DeclarationNode::Union:
    1053                           ret = new UnionInstType( buildQualifiers( type ), (UnionDecl *)typedecl );
    1054                           break;
    1055                         case DeclarationNode::Trait:
    1056                           assert( false );
    1057                           //ret = new TraitInstType( buildQualifiers( type ), (TraitDecl *)typedecl );
    1058                           break;
    1059                         default:
    1060                           assert( false );
    1061                   } // switch
     1047                  if ( type->aggregate.body ) {
     1048                          AggregateDecl * typedecl = buildAggregate( type, attributes );
     1049                          switch ( type->aggregate.kind ) {
     1050                                case DeclarationNode::Struct:
     1051                                  ret = new StructInstType( buildQualifiers( type ), (StructDecl *)typedecl );
     1052                                  break;
     1053                                case DeclarationNode::Union:
     1054                                  ret = new UnionInstType( buildQualifiers( type ), (UnionDecl *)typedecl );
     1055                                  break;
     1056                                case DeclarationNode::Trait:
     1057                                  assert( false );
     1058                                  //ret = new TraitInstType( buildQualifiers( type ), (TraitDecl *)typedecl );
     1059                                  break;
     1060                                default:
     1061                                  assert( false );
     1062                          } // switch
     1063                  } else {
     1064                          switch ( type->aggregate.kind ) {
     1065                                case DeclarationNode::Struct:
     1066                                  ret = new StructInstType( buildQualifiers( type ), *type->aggregate.name );
     1067                                  break;
     1068                                case DeclarationNode::Union:
     1069                                  ret = new UnionInstType( buildQualifiers( type ), *type->aggregate.name );
     1070                                  break;
     1071                                case DeclarationNode::Trait:
     1072                                  assert( false );
     1073                                  //ret = new TraitInstType( buildQualifiers( type ), (TraitDecl *)typedecl );
     1074                                  break;
     1075                                default:
     1076                                  assert( false );
     1077                          } // switch
     1078                  } // if
    10621079                  buildList( type->aggregate.actuals, ret->get_parameters() );
    10631080                  return ret;
Note: See TracChangeset for help on using the changeset viewer.