File tree Expand file tree Collapse file tree 4 files changed +33
-20
lines changed Expand file tree Collapse file tree 4 files changed +33
-20
lines changed Original file line number Diff line number Diff line change @@ -197,18 +197,18 @@ class MRDOCS_VISIBLE
197
197
198
198
@return A reference to the string `temp`.
199
199
*/
200
- // KRYSTIAN NOTE: temporary
201
200
MRDOCS_DECL
202
- std::string&
203
- getFullyQualifiedName (
204
- const Info& I,
201
+ void
202
+ qualifiedName (
203
+ Info const & I,
205
204
std::string& temp) const ;
206
205
207
206
std::string
208
- getFullyQualifiedName (const Info& I) const
207
+ qualifiedName (const Info& I) const
209
208
{
210
209
std::string temp;
211
- return getFullyQualifiedName (I, temp);
210
+ qualifiedName (I, temp);
211
+ return temp;
212
212
}
213
213
214
214
};
Original file line number Diff line number Diff line change @@ -161,24 +161,28 @@ writeIndex()
161
161
tags_.open (" symbols" );
162
162
if (options_.legible_names )
163
163
{
164
- LegibleNames names (corpus_, true );
164
+ LegibleNames const names (corpus_, true );
165
165
for (auto & I : corpus_)
166
166
{
167
+ corpus_.qualifiedName (I, temp);
167
168
auto legible_name = names.getUnqualified (I.id );
168
169
tags_.write (" symbol" , {}, {
169
170
{ " legible" , legible_name },
170
- { " name" , corpus_. getFullyQualifiedName (I, temp) },
171
+ { " name" , temp },
171
172
{ " tag" , toString (I.Kind ) },
172
173
{ I.id } });
173
174
}
174
175
}
175
176
else
176
177
{
177
178
for (auto & I : corpus_)
179
+ {
180
+ corpus_.qualifiedName (I, temp);
178
181
tags_.write (" symbol" , {}, {
179
- { " name" , corpus_. getFullyQualifiedName (I, temp) },
182
+ { " name" , temp },
180
183
{ " tag" , toString (I.Kind ) },
181
184
{ I.id } });
185
+ }
182
186
}
183
187
tags_.close (" symbols" );
184
188
}
Original file line number Diff line number Diff line change @@ -51,15 +51,17 @@ globalNamespace() const noexcept
51
51
// ------------------------------------------------
52
52
53
53
// KRYSTIAN NOTE: temporary
54
- std::string&
54
+ void
55
55
Corpus::
56
- getFullyQualifiedName (
56
+ qualifiedName (
57
57
const Info& I,
58
58
std::string& temp) const
59
59
{
60
60
temp.clear ();
61
61
if (! I.id || I.id == SymbolID::global)
62
- return temp;
62
+ {
63
+ return ;
64
+ }
63
65
64
66
MRDOCS_ASSERT (I.Parent );
65
67
for (auto const & pID : getParents (*this , I))
@@ -99,22 +101,29 @@ getFullyQualifiedName(
99
101
{
100
102
temp.append (I.Name );
101
103
}
102
- return temp;
103
104
}
104
105
105
106
std::vector<SymbolID>
106
107
getParents (Corpus const & C, const Info& I)
107
108
{
108
- // AFREITAS: This function could eventually
109
- // return a view.
110
109
std::vector<SymbolID> parents;
110
+ std::size_t n = 0 ;
111
111
auto curParent = I.Parent ;
112
112
while (curParent)
113
113
{
114
- parents.push_back (curParent);
114
+ ++n;
115
+ MRDOCS_ASSERT (C.find (curParent));
116
+ curParent = C.get (curParent).Parent ;
117
+ }
118
+ parents.reserve (n);
119
+ parents.resize (n);
120
+ curParent = I.Parent ;
121
+ while (curParent)
122
+ {
123
+ parents[--n] = curParent;
124
+ MRDOCS_ASSERT (C.find (curParent));
115
125
curParent = C.get (curParent).Parent ;
116
126
}
117
- std::ranges::reverse (parents);
118
127
return parents;
119
128
}
120
129
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ writeNamespace(
134
134
{ " kind" , " namespace" }
135
135
});
136
136
137
- tags_.write (" name" , corpus_->getFullyQualifiedName (I));
137
+ tags_.write (" name" , corpus_->qualifiedName (I));
138
138
tags_.write (" filename" , generateFilename (I));
139
139
140
140
// Write the class-like members of this namespace
@@ -144,7 +144,7 @@ writeNamespace(
144
144
{
145
145
tags_.write (
146
146
" class" ,
147
- corpus_->getFullyQualifiedName (J),
147
+ corpus_->qualifiedName (J),
148
148
{{" kind" , " class" }});
149
149
}
150
150
});
@@ -178,7 +178,7 @@ writeClassLike(
178
178
tags_.open (" compound" , {
179
179
{ " kind" , " class" }
180
180
});
181
- tags_.write (" name" , corpus_->getFullyQualifiedName (I));
181
+ tags_.write (" name" , corpus_->qualifiedName (I));
182
182
tags_.write (" filename" , generateFilename (I));
183
183
if constexpr (T::isRecord ())
184
184
{
You can’t perform that action at this time.
0 commit comments