- Timestamp:
- Jul 6, 2023, 4:32:01 PM (14 months ago)
- Branches:
- master
- Children:
- 2fe64ba
- Parents:
- 8f31be6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Validate/LinkReferenceToTypes.cpp
r8f31be6 rb4d2b3b 80 80 ast::EnumInstType const * LinkTypesCore::postvisit( ast::EnumInstType const * type ) { 81 81 ast::EnumDecl const * decl = symtab.lookupEnum( type->name ); 82 ast::EnumInstType * mut = ast::mutate( type ); 82 83 // It's not a semantic error if the enum is not found, just an implicit forward declaration. 83 84 if ( decl ) { 84 85 // Just linking in the node. 85 auto mut = ast::mutate( type );86 86 mut->base = decl; 87 type = mut;88 87 } 89 88 if ( !decl || !decl->body ) { 90 auto mut = ast::mutate( type );91 89 forwardEnums[ mut->name ].push_back( mut ); 92 type = mut; 93 } 94 return type; 90 } 91 return mut; 95 92 } 96 93 97 94 ast::StructInstType const * LinkTypesCore::postvisit( ast::StructInstType const * type ) { 98 95 ast::StructDecl const * decl = symtab.lookupStruct( type->name ); 96 ast::StructInstType * mut = ast::mutate( type ); 99 97 // It's not a semantic error if the struct is not found, just an implicit forward declaration. 100 98 if ( decl ) { 101 99 // Just linking in the node. 102 auto mut = ast::mutate( type );103 100 mut->base = decl; 104 type = mut;105 101 } 106 102 if ( !decl || !decl->body ) { 107 auto mut = ast::mutate( type );108 103 forwardStructs[ mut->name ].push_back( mut ); 109 type = mut; 110 } 111 return type; 104 } 105 return mut; 112 106 } 113 107 114 108 ast::UnionInstType const * LinkTypesCore::postvisit( ast::UnionInstType const * type ) { 115 109 ast::UnionDecl const * decl = symtab.lookupUnion( type->name ); 110 ast::UnionInstType * mut = ast::mutate( type ); 116 111 // It's not a semantic error if the union is not found, just an implicit forward declaration. 117 112 if ( decl ) { 118 113 // Just linking in the node. 119 auto mut = ast::mutate( type );120 114 mut->base = decl; 121 type = mut;122 115 } 123 116 if ( !decl || !decl->body ) { 124 auto mut = ast::mutate( type );125 117 forwardUnions[ mut->name ].push_back( mut ); 126 type = mut; 127 } 128 return type; 118 } 119 return mut; 129 120 } 130 121
Note: See TracChangeset
for help on using the changeset viewer.