@@ -209,7 +209,9 @@ static json::Value extractValue(const TypedefInfo &I) {
209
209
210
210
static json::Value extractValue (const CommentInfo &I) {
211
211
Object Obj = Object ();
212
- Object Child;
212
+
213
+ json::Value ChildVal = Object ();
214
+ Object &Child = *ChildVal.getAsObject ();
213
215
214
216
json::Value ChildArr = Array ();
215
217
auto &CARef = *ChildArr.getAsArray ();
@@ -226,19 +228,19 @@ static json::Value extractValue(const CommentInfo &I) {
226
228
case CommentKind::CK_BlockCommandComment: {
227
229
Child.insert ({" Command" , I.Name });
228
230
Child.insert ({" Children" , ChildArr});
229
- Obj.insert ({commentKindToString (I.Kind ), json::Value ( std::move (Child)) });
231
+ Obj.insert ({commentKindToString (I.Kind ), ChildVal });
230
232
return Obj;
231
233
}
232
234
233
235
case CommentKind::CK_InlineCommandComment: {
234
236
json::Value ArgsArr = Array ();
235
- for (const auto &Arg : I.Args ) {
237
+ for (const auto &Arg : I.Args )
236
238
ArgsArr.getAsArray ()->emplace_back (Arg);
237
- }
239
+
238
240
Child.insert ({" Command" , I.Name });
239
241
Child.insert ({" Args" , ArgsArr});
240
242
Child.insert ({" Children" , ChildArr});
241
- Obj.insert ({commentKindToString (I.Kind ), json::Value ( std::move (Child)) });
243
+ Obj.insert ({commentKindToString (I.Kind ), ChildVal });
242
244
return Obj;
243
245
}
244
246
@@ -248,24 +250,24 @@ static json::Value extractValue(const CommentInfo &I) {
248
250
Child.insert ({" Direction" , I.Direction });
249
251
Child.insert ({" Explicit" , I.Explicit });
250
252
Child.insert ({" Children" , ChildArr});
251
- Obj.insert ({commentKindToString (I.Kind ), json::Value ( std::move (Child)) });
253
+ Obj.insert ({commentKindToString (I.Kind ), ChildVal });
252
254
return Obj;
253
255
}
254
256
255
257
case CommentKind::CK_VerbatimBlockComment: {
256
258
Child.insert ({" Text" , I.Text });
257
- Child.insert ({" Children" , ChildArr});
258
259
if (!I.CloseName .empty ())
259
260
Child.insert ({" CloseName" , I.CloseName });
260
- Obj.insert ({commentKindToString (I.Kind ), json::Value (std::move (Child))});
261
+ Child.insert ({" Children" , ChildArr});
262
+ Obj.insert ({commentKindToString (I.Kind ), ChildVal});
261
263
return Obj;
262
264
}
263
265
264
266
case CommentKind::CK_VerbatimBlockLineComment:
265
267
case CommentKind::CK_VerbatimLineComment: {
266
268
Child.insert ({" Text" , I.Text });
267
269
Child.insert ({" Children" , ChildArr});
268
- Obj.insert ({commentKindToString (I.Kind ), json::Value ( std::move (Child)) });
270
+ Obj.insert ({commentKindToString (I.Kind ), ChildVal });
269
271
return Obj;
270
272
}
271
273
@@ -283,21 +285,21 @@ static json::Value extractValue(const CommentInfo &I) {
283
285
Child.insert ({" AttrKeys" , AttrKeysArray});
284
286
Child.insert ({" AttrValues" , AttrValuesArray});
285
287
Child.insert ({" Children" , ChildArr});
286
- Obj.insert ({commentKindToString (I.Kind ), json::Value ( std::move (Child)) });
288
+ Obj.insert ({commentKindToString (I.Kind ), ChildVal });
287
289
return Obj;
288
290
}
289
291
290
292
case CommentKind::CK_HTMLEndTagComment: {
291
293
Child.insert ({" Name" , I.Name });
292
294
Child.insert ({" Children" , ChildArr});
293
- Obj.insert ({commentKindToString (I.Kind ), json::Value ( std::move (Child)) });
295
+ Obj.insert ({commentKindToString (I.Kind ), ChildVal });
294
296
return Obj;
295
297
}
296
298
297
299
case CommentKind::CK_FullComment:
298
300
case CommentKind::CK_ParagraphComment: {
299
301
Child.insert ({" Children" , ChildArr});
300
- Obj.insert ({commentKindToString (I.Kind ), json::Value ( std::move (Child)) });
302
+ Obj.insert ({commentKindToString (I.Kind ), ChildVal });
301
303
return Obj;
302
304
}
303
305
0 commit comments