Changes in src/Parser/DeclarationNode.cc [3a5131ed:ca1a547]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r3a5131ed rca1a547 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 16 13:06:50201713 // Update Count : 75 312 // Last Modified On : Thu Feb 23 15:45:02 2017 13 // Update Count : 759 14 14 // 15 15 … … 174 174 } // if 175 175 176 if ( body ) {177 newnode->type->function.hasBody = true;178 } // if179 180 176 if ( ret ) { 181 177 newnode->type->base = ret->type; … … 259 255 } // DeclarationNode::newAggregate 260 256 261 DeclarationNode * DeclarationNode::newEnum( string * name, DeclarationNode * constants ) {257 DeclarationNode * DeclarationNode::newEnum( string * name, DeclarationNode * constants, bool body ) { 262 258 DeclarationNode * newnode = new DeclarationNode; 263 259 newnode->type = new TypeData( TypeData::Enum ); … … 268 264 } // if 269 265 newnode->type->enumeration.constants = constants; 266 newnode->type->enumeration.body = body; 270 267 return newnode; 271 268 } // DeclarationNode::newEnum … … 698 695 assert( ! type->function.body ); 699 696 type->function.body = body; 700 type->function.hasBody = true;701 697 return this; 702 698 } … … 1040 1036 switch ( type->kind ) { 1041 1037 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 } 1044 1044 } 1045 1045 case TypeData::Aggregate: { 1046 AggregateDecl * typedecl = buildAggregate( type, attributes );1047 1046 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 1062 1079 buildList( type->aggregate.actuals, ret->get_parameters() ); 1063 1080 return ret;
Note: See TracChangeset
for help on using the changeset viewer.