Changeset a3525c4
- Timestamp:
- Mar 12, 2024, 4:04:53 PM (9 months ago)
- Branches:
- master
- Children:
- 30a1f0c
- Parents:
- 423c0cd
- Location:
- src/Parser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r423c0cd ra3525c4 296 296 newnode->type->array.dimension = size; 297 297 newnode->type->array.isStatic = isStatic; 298 if ( newnode->type->array.dimension == nullptr || newnode->type->array.dimension->isExpressionType<ast::ConstantExpr *>() ) { 299 newnode->type->array.isVarLen = false; 300 } else { 301 newnode->type->array.isVarLen = true; 302 } // if 298 newnode->type->array.isVarLen = size && !size->isExpressionType<ast::ConstantExpr *>(); 303 299 return newnode->addQualifiers( qualifiers ); 304 300 } // DeclarationNode::newArray -
src/Parser/TypeData.cc
r423c0cd ra3525c4 1291 1291 1292 1292 1293 static ast::Type * buildDefaultType( const TypeData * td ) { 1294 return ( td ) ? typebuild( td ) : new ast::BasicType( ast::BasicType::SignedInt ); 1295 } // buildDefaultType 1296 1297 1293 1298 ast::PointerType * buildPointer( const TypeData * td ) { 1294 ast::PointerType * pt; 1295 if ( td->base ) { 1296 pt = new ast::PointerType( 1297 typebuild( td->base ), 1298 buildQualifiers( td ) 1299 ); 1300 } else { 1301 pt = new ast::PointerType( 1302 new ast::BasicType( ast::BasicType::SignedInt ), 1303 buildQualifiers( td ) 1304 ); 1305 } // if 1306 return pt; 1299 return new ast::PointerType( 1300 buildDefaultType( td->base ), 1301 buildQualifiers( td ) 1302 ); 1307 1303 } // buildPointer 1308 1304 1309 1305 1310 1306 ast::ArrayType * buildArray( const TypeData * td ) { 1311 ast::ArrayType * at; 1312 if ( td->base ) { 1313 at = new ast::ArrayType( 1314 typebuild( td->base ), 1315 maybeBuild( td->array.dimension ), 1316 td->array.isVarLen ? ast::VariableLen : ast::FixedLen, 1317 td->array.isStatic ? ast::StaticDim : ast::DynamicDim, 1318 buildQualifiers( td ) 1319 ); 1320 } else { 1321 at = new ast::ArrayType( 1322 new ast::BasicType( ast::BasicType::SignedInt ), 1323 maybeBuild( td->array.dimension ), 1324 td->array.isVarLen ? ast::VariableLen : ast::FixedLen, 1325 td->array.isStatic ? ast::StaticDim : ast::DynamicDim, 1326 buildQualifiers( td ) 1327 ); 1328 } // if 1329 return at; 1307 return new ast::ArrayType( 1308 buildDefaultType( td->base ), 1309 maybeBuild( td->array.dimension ), 1310 td->array.isVarLen ? ast::VariableLen : ast::FixedLen, 1311 td->array.isStatic ? ast::StaticDim : ast::DynamicDim, 1312 buildQualifiers( td ) 1313 ); 1330 1314 } // buildArray 1331 1315 1332 1316 1333 1317 ast::ReferenceType * buildReference( const TypeData * td ) { 1334 ast::ReferenceType * rt; 1335 if ( td->base ) { 1336 rt = new ast::ReferenceType( 1337 typebuild( td->base ), 1338 buildQualifiers( td ) 1339 ); 1340 } else { 1341 rt = new ast::ReferenceType( 1342 new ast::BasicType( ast::BasicType::SignedInt ), 1343 buildQualifiers( td ) 1344 ); 1345 } // if 1346 return rt; 1318 return new ast::ReferenceType( 1319 buildDefaultType( td->base ), 1320 buildQualifiers( td ) 1321 ); 1347 1322 } // buildReference 1348 1323
Note: See TracChangeset
for help on using the changeset viewer.