Changeset 8315947 for src/AST/SymbolTable.cpp
- Timestamp:
- Jul 13, 2024, 3:29:22 PM (2 months ago)
- Branches:
- master
- Children:
- 2e6b2a0
- Parents:
- 76b507d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/SymbolTable.cpp
r76b507d r8315947 419 419 void SymbolTable::addWith( const std::vector< ptr<Expr> > & withExprs, const Decl * withStmt ) { 420 420 for ( const Expr * expr : withExprs ) { 421 if ( ! expr->result ) continue; 422 const Type * resTy = expr->result->stripReferences(); 423 auto aggrType = dynamic_cast< const BaseInstType * >( resTy ); 424 assertf( aggrType, "WithStmt expr has non-aggregate type: %s", 425 toString( expr->result ).c_str() ); 426 const AggregateDecl * aggr = aggrType->aggr(); 427 assertf( aggr, "WithStmt has null aggregate from type: %s", 428 toString( expr->result ).c_str() ); 429 430 addMembers( aggr, expr, OnConflict::deleteWith( withStmt ) ); 421 if ( expr->result ) { 422 const Type * resTy = expr->result->stripReferences(); 423 auto aggrType = dynamic_cast< const BaseInstType * >( resTy ); 424 assertf( aggrType, "WithStmt expr has non-aggregate type: %s", 425 toString( expr->result ).c_str() ); 426 const AggregateDecl * aggr = aggrType->aggr(); 427 assertf( aggr, "WithStmt has null aggregate from type: %s", 428 toString( expr->result ).c_str() ); 429 430 addMembers( aggr, expr, OnConflict::deleteWith( withStmt ) ); 431 } else { 432 auto typeExpr = dynamic_cast< const ast::TypeExpr *>( expr ); 433 if ( !typeExpr ) continue; 434 auto declEnumInst = typeExpr->type.as<ast::EnumInstType>(); 435 // assertf( declEnumInst, "WithStmt expr unsupprot type expression: %s", 436 // toString( typeExpr->type ).c_str()); 437 if ( !declEnumInst ) continue; 438 439 const EnumDecl * aggr = declEnumInst->aggr(); 440 // assertf( aggr, "WithStmt has null aggregate from type: %s", 441 // toString( typeExpr ).c_str() ); 442 // addMembers( aggr, expr, OnConflict::deleteWith( withStmt ) ); 443 if ( !aggr ) { 444 aggr = lookupEnum( declEnumInst->name ); 445 assert( aggr ); 446 } 447 addMembers( aggr, expr, OnConflict::deleteWith( withStmt ) ); 448 } 431 449 } 432 450 } … … 800 818 if ( auto rty = dynamic_cast<const BaseInstType *>( t ) ) { 801 819 if ( ! dynamic_cast<const StructInstType *>(rty) 802 && ! dynamic_cast<const UnionInstType *>(rty) ) continue; 820 && ! dynamic_cast<const UnionInstType *>(rty) 821 && ! dynamic_cast<const EnumInstType *>(rty) ) continue; 803 822 ResolvExpr::Cost cost = ResolvExpr::Cost::zero; 804 823 ast::ptr<ast::TypeSubstitution> tmp = expr->env;
Note: See TracChangeset
for help on using the changeset viewer.