Changeset 2a301ff for src/Validate/FixQualifiedTypes.cpp
- Timestamp:
- Aug 31, 2023, 11:31:15 PM (2 years ago)
- Branches:
- master
- Children:
- 950c58e
- Parents:
- 92355883 (diff), 686912c (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/Validate/FixQualifiedTypes.cpp
r92355883 r2a301ff 89 89 } 90 90 91 ast::Expr const * postvisit( ast::QualifiedNameExpr const * t ) {91 ast::Expr const * postvisit( ast::QualifiedNameExpr const * t ) { 92 92 assert( location ); 93 if ( t->type_decl ) { 94 auto enumName = t->type_decl->name; 95 const ast::EnumDecl * enumDecl = symtab.lookupEnum( enumName ); 96 for ( ast::ptr<ast::Decl> const & member : enumDecl->members ) { 97 if ( auto memberAsObj = member.as<ast::ObjectDecl>() ) { 98 if ( memberAsObj->name == t->name ) { 99 return new ast::VariableExpr( t->location, memberAsObj ); 100 } 101 } else { 102 assertf( false, "unhandled qualified child type"); 93 if ( !t->type_decl ) return t; 94 95 auto enumName = t->type_decl->name; 96 const ast::EnumDecl * enumDecl = symtab.lookupEnum( enumName ); 97 for ( ast::ptr<ast::Decl> const & member : enumDecl->members ) { 98 if ( auto memberAsObj = member.as<ast::ObjectDecl>() ) { 99 if ( memberAsObj->name == t->name ) { 100 return new ast::VariableExpr( t->location, memberAsObj ); 103 101 } 102 } else { 103 assertf( false, "unhandled qualified child type" ); 104 104 } 105 } 105 106 106 auto var = new ast::ObjectDecl( t->location, t->name, 107 new ast::EnumInstType(enumDecl, ast::CV::Const), nullptr, {}, ast::Linkage::Cforall ); 108 var->mangleName = Mangle::mangle( var ); 109 return new ast::VariableExpr( t->location, var ); 110 } 111 112 return t; 107 auto var = new ast::ObjectDecl( t->location, t->name, 108 new ast::EnumInstType( enumDecl, ast::CV::Const ), 109 nullptr, {}, ast::Linkage::Cforall ); 110 var->mangleName = Mangle::mangle( var ); 111 return new ast::VariableExpr( t->location, var ); 113 112 } 114 113
Note:
See TracChangeset
for help on using the changeset viewer.