Changeset 5408b59 for src/Validate/LinkReferenceToTypes.cpp
- Timestamp:
- Oct 18, 2022, 9:12:19 PM (21 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- c2b3243
- Parents:
- 1e30df7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Validate/LinkReferenceToTypes.cpp
r1e30df7 r5408b59 44 44 void postvisit( ast::UnionDecl const * decl ); 45 45 ast::TraitDecl const * postvisit( ast::TraitDecl const * decl ); 46 ast::QualifiedNameExpr const * previsit( ast::QualifiedNameExpr const * decl);47 46 48 47 private: … … 316 315 } 317 316 318 ast::QualifiedNameExpr const * LinkTypesCore::previsit( ast::QualifiedNameExpr const * decl ) {319 // Try to lookup type320 if ( auto objDecl = decl->type_decl.as<ast::ObjectDecl>() ) {321 if ( auto inst = objDecl->type.as<ast::TypeInstType>()) {322 if ( auto enumDecl = symtab.lookupEnum ( inst->name ) ) {323 auto mut = ast::mutate( decl );324 mut->type_decl = enumDecl;325 auto enumInst = new ast::EnumInstType( enumDecl );326 enumInst->name = decl->name;327 // Adding result; addCandidate() use result328 mut->result = enumInst;329 decl = mut;330 }331 }332 } else if ( auto enumDecl = decl->type_decl.as<ast::EnumDecl>() ) {333 auto mut = ast::mutate( decl );334 auto enumInst = new ast::EnumInstType( enumDecl );335 enumInst->name = decl->name;336 // Adding result; addCandidate() use result337 mut->result = enumInst;338 decl = mut;339 }340 // ast::EnumDecl const * decl = symtab.lookupEnum( type->name );341 // // It's not a semantic error if the enum is not found, just an implicit forward declaration.342 // if ( decl ) {343 // // Just linking in the node.344 // auto mut = ast::mutate( type );345 // mut->base = const_cast<ast::EnumDecl *>( decl );346 // type = mut;347 // }348 return decl;349 }350 351 317 } // namespace 352 318
Note: See TracChangeset
for help on using the changeset viewer.