Skip to content

Commit 36cd25a

Browse files
committed
fix: UsingSymbol is SymbolParent
1 parent 6b0206c commit 36cd25a

File tree

7 files changed

+42
-2
lines changed

7 files changed

+42
-2
lines changed

include/mrdocs/Metadata/Symbol/Using.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,15 @@ tag_invoke(
174174
v = dom::LazyObject(I, domCorpus);
175175
}
176176

177+
inline
178+
auto&
179+
allMembers(UsingSymbol const& T)
180+
{
181+
return T.ShadowDeclarations;
182+
}
183+
184+
static_assert(SymbolParent<UsingSymbol>);
185+
177186
} // mrdocs
178187

179188
#endif // MRDOCS_API_METADATA_SYMBOL_USING_HPP

src/lib/AST/ASTVisitor.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,6 +1904,13 @@ addMember(OverloadsSymbol& I, Symbol const& Member) const
19041904
I.Name);
19051905
}
19061906

1907+
void
1908+
ASTVisitor::
1909+
addMember(UsingSymbol& I, Symbol const& Member) const
1910+
{
1911+
addMember(I.ShadowDeclarations, Member);
1912+
}
1913+
19071914
void
19081915
ASTVisitor::
19091916
addMember(std::vector<SymbolID>& container, Symbol const& Member) const

src/lib/AST/ASTVisitor.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,9 @@ class ASTVisitor
759759
void
760760
addMember(OverloadsSymbol& I, Symbol const& Member) const;
761761

762+
void
763+
addMember(UsingSymbol& I, Symbol const& Member) const;
764+
762765
void
763766
addMember(std::vector<SymbolID>& container, Symbol const& Member) const;
764767

src/lib/Gen/hbs/MultiPageVisitor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ operator()(T const& I)
6868
// ===================================
6969
// Traverse the symbol members
7070
// ===================================
71+
MRDOCS_CHECK_OR_VOID(!I.isUsing());
7172
Corpus::TraverseOptions opts = {.skipInherited = std::same_as<T, RecordSymbol>};
7273
corpus_.traverse(opts, I, *this);
7374
});

src/lib/Gen/hbs/SinglePageVisitor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ operator()(T const& I)
3838
}
3939
});
4040
}
41+
MRDOCS_CHECK_OR_VOID(!I.isUsing());
4142
Corpus::TraverseOptions opts = {.skipInherited = std::same_as<T, RecordSymbol>};
4243
corpus_.traverse(opts, I, *this);
4344
}

src/lib/Support/LegibleNames.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,26 @@ class LegibleNames::Impl
291291
MRDOCS_ASSERT(corpus_.exists(id));
292292

293293
// Find the legible name information for this symbol
294-
auto const it = map_.find(id);
295-
MRDOCS_ASSERT(it != map_.end());
294+
auto it = map_.find(id);
295+
if (it == map_.end())
296+
{
297+
// Late-build a legible name for this symbol.
298+
// NOTE: This may not perfectly disambiguate against siblings
299+
// because the per-scope disambiguation_map_ is ephemeral,
300+
// but it avoids a hard crash and produces a stable name.
301+
Symbol const& I = corpus_.get(id);
302+
auto const raw = getRawUnqualified(I);
303+
buildLegibleMember(I, raw);
304+
it = map_.find(I.id);
305+
if (it == map_.end())
306+
{
307+
// Final, robust fallback: emit the raw SymbolID (legible-ish),
308+
// and return without crashing.
309+
result.append(toBase16(I.id));
310+
return;
311+
}
312+
}
313+
296314
auto& [unqualified, n_disambig, id_str] = it->second;
297315

298316
// Append the unqualified name to the result
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
warn-if-undoc-enum-val: false

0 commit comments

Comments
 (0)