Changeset a4da45e for src/Parser/TypeData.cc
- Timestamp:
- Feb 26, 2024, 3:53:42 AM (7 months ago)
- Branches:
- master
- Children:
- 3f9a8d0
- Parents:
- 0522ebe (diff), 022bce0 (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/TypeData.cc
r0522ebe ra4da45e 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 14 18:59:12 202313 // Update Count : 68412 // Last Modified On : Fri Feb 23 08:58:30 2024 13 // Update Count : 734 14 14 // 15 15 … … 20 20 21 21 #include "AST/Decl.hpp" // for AggregateDecl, ObjectDecl, TypeDe... 22 #include "AST/Attribute.hpp" // for Attribute 22 23 #include "AST/Init.hpp" // for SingleInit, ListInit 23 24 #include "AST/Print.hpp" // for print 24 25 #include "Common/SemanticError.h" // for SemanticError 25 26 #include "Common/utility.h" // for splice, spliceBegin 27 #include "Common/Iterate.hpp" // for reverseIterate 26 28 #include "Parser/ExpressionNode.h" // for ExpressionNode 27 29 #include "Parser/StatementNode.h" // for StatementNode … … 199 201 newtype->aggregate.kind = aggregate.kind; 200 202 newtype->aggregate.name = aggregate.name ? new string( *aggregate.name ) : nullptr; 203 newtype->aggregate.parent = aggregate.parent ? new string( *aggregate.parent ) : nullptr; 201 204 newtype->aggregate.params = maybeCopy( aggregate.params ); 202 205 newtype->aggregate.actuals = maybeCopy( aggregate.actuals ); 203 206 newtype->aggregate.fields = maybeCopy( aggregate.fields ); 207 newtype->aggregate.attributes = aggregate.attributes; 204 208 newtype->aggregate.body = aggregate.body; 205 209 newtype->aggregate.anon = aggregate.anon; 206 210 newtype->aggregate.tagged = aggregate.tagged; 207 newtype->aggregate.parent = aggregate.parent ? new string( *aggregate.parent ) : nullptr;208 211 break; 209 212 case AggregateInst: … … 336 339 } // if 337 340 if ( aggregate.body ) { 338 os << string( indent + 2, ' ' ) << " with body" << endl; 341 os << string( indent + 2, ' ' ) << "with body" << endl; 342 } // if 343 if ( ! aggregate.attributes.empty() ) { 344 os << string( indent + 2, ' ' ) << "with attributes" << endl; 345 for ( ast::ptr<ast::Attribute> const & attr : reverseIterate( aggregate.attributes ) ) { 346 os << string( indent + 4, ' ' ); 347 ast::print( os, attr, indent + 2 ); 348 } // for 339 349 } // if 340 350 break; … … 358 368 } // if 359 369 if ( enumeration.body ) { 360 os << string( indent + 2, ' ' ) << " 370 os << string( indent + 2, ' ' ) << "with body" << endl; 361 371 } // if 362 372 if ( base ) { … … 1088 1098 1089 1099 ast::BaseInstType * buildComAggInst( 1090 const TypeData * t ype,1100 const TypeData * td, 1091 1101 std::vector<ast::ptr<ast::Attribute>> && attributes, 1092 1102 ast::Linkage::Spec linkage ) { 1093 switch ( t ype->kind ) {1103 switch ( td->kind ) { 1094 1104 case TypeData::Enum: 1095 if ( t ype->enumeration.body ) {1105 if ( td->enumeration.body ) { 1096 1106 ast::EnumDecl * typedecl = 1097 buildEnum( t ype, std::move( attributes ), linkage );1107 buildEnum( td, std::move( attributes ), linkage ); 1098 1108 return new ast::EnumInstType( 1099 1109 typedecl, 1100 buildQualifiers( t ype)1110 buildQualifiers( td ) 1101 1111 ); 1102 1112 } else { 1103 1113 return new ast::EnumInstType( 1104 *t ype->enumeration.name,1105 buildQualifiers( t ype)1114 *td->enumeration.name, 1115 buildQualifiers( td ) 1106 1116 ); 1107 1117 } // if 1108 1118 break; 1109 1119 case TypeData::Aggregate: 1110 if ( t ype->aggregate.body ) {1120 if ( td->aggregate.body ) { 1111 1121 ast::AggregateDecl * typedecl = 1112 buildAggregate( t ype, std::move( attributes ), linkage );1113 switch ( t ype->aggregate.kind ) {1122 buildAggregate( td, std::move( attributes ), linkage ); 1123 switch ( td->aggregate.kind ) { 1114 1124 case ast::AggregateDecl::Struct: 1115 1125 case ast::AggregateDecl::Coroutine: … … 1118 1128 return new ast::StructInstType( 1119 1129 strict_dynamic_cast<ast::StructDecl *>( typedecl ), 1120 buildQualifiers( t ype)1130 buildQualifiers( td ) 1121 1131 ); 1122 1132 case ast::AggregateDecl::Union: 1123 1133 return new ast::UnionInstType( 1124 1134 strict_dynamic_cast<ast::UnionDecl *>( typedecl ), 1125 buildQualifiers( t ype)1135 buildQualifiers( td ) 1126 1136 ); 1127 1137 case ast::AggregateDecl::Trait: … … 1132 1142 } // switch 1133 1143 } else { 1134 switch ( t ype->aggregate.kind ) {1144 switch ( td->aggregate.kind ) { 1135 1145 case ast::AggregateDecl::Struct: 1136 1146 case ast::AggregateDecl::Coroutine: … … 1138 1148 case ast::AggregateDecl::Thread: 1139 1149 return new ast::StructInstType( 1140 *t ype->aggregate.name,1141 buildQualifiers( t ype)1150 *td->aggregate.name, 1151 buildQualifiers( td ) 1142 1152 ); 1143 1153 case ast::AggregateDecl::Union: 1144 1154 return new ast::UnionInstType( 1145 *t ype->aggregate.name,1146 buildQualifiers( t ype)1155 *td->aggregate.name, 1156 buildQualifiers( td ) 1147 1157 ); 1148 1158 case ast::AggregateDecl::Trait: 1149 1159 return new ast::TraitInstType( 1150 *t ype->aggregate.name,1151 buildQualifiers( t ype)1160 *td->aggregate.name, 1161 buildQualifiers( td ) 1152 1162 ); 1153 1163 default:
Note: See TracChangeset
for help on using the changeset viewer.