15
15
*/
16
16
17
17
#include < thrift/lib/cpp2/dynamic/TypeSystemBuilder.h>
18
+ #include < thrift/lib/cpp2/dynamic/detail/TypeSystem.h>
18
19
19
20
#include < folly/Overload.h>
20
21
#include < folly/container/F14Set.h>
@@ -459,20 +460,6 @@ void TypeSystemBuilder::tryEmplace(Uri uri, DefinitionEntry&& def) {
459
460
}
460
461
}
461
462
462
- namespace {
463
-
464
- using RawAnnotations = folly::F14FastMap<Uri, SerializableRecordUnion>;
465
-
466
- static RawAnnotations toRawAnnotations (const AnnotationsMap& annotations) {
467
- RawAnnotations raw;
468
- for (const auto & [uri, record] : annotations) {
469
- raw.emplace (uri, SerializableRecord::toThrift (record));
470
- }
471
- return raw;
472
- }
473
-
474
- } // namespace
475
-
476
463
/* static */ FieldIdentity TypeSystemBuilder::DefinitionHelper::Identity (
477
464
std::int16_t id, std::string_view name) {
478
465
return FieldIdentity{FieldId{id}, std::string (name)};
@@ -492,7 +479,7 @@ TypeSystemBuilder::DefinitionHelper::Field(
492
479
if (customDefault.has_value ()) {
493
480
def.customDefaultValue () = SerializableRecord::toThrift (*customDefault);
494
481
}
495
- def.annotations () = toRawAnnotations (annotations);
482
+ def.annotations () = detail:: toRawAnnotations (annotations);
496
483
return def;
497
484
}
498
485
@@ -504,7 +491,7 @@ TypeSystemBuilder::DefinitionHelper::Struct(
504
491
SerializableStructDefinition def;
505
492
def.fields () = fields;
506
493
def.isSealed () = isSealed;
507
- def.annotations () = toRawAnnotations (annotations);
494
+ def.annotations () = detail:: toRawAnnotations (annotations);
508
495
return def;
509
496
}
510
497
@@ -516,7 +503,7 @@ TypeSystemBuilder::DefinitionHelper::Union(
516
503
SerializableUnionDefinition def;
517
504
def.fields () = fields;
518
505
def.isSealed () = isSealed;
519
- def.annotations () = toRawAnnotations (annotations);
506
+ def.annotations () = detail:: toRawAnnotations (annotations);
520
507
return def;
521
508
}
522
509
@@ -528,10 +515,10 @@ TypeSystemBuilder::DefinitionHelper::Enum(
528
515
SerializableEnumValueDefinition v;
529
516
v.name () = name;
530
517
v.datum () = value;
531
- v.annotations () = toRawAnnotations (enumValueAnnotations);
518
+ v.annotations () = detail:: toRawAnnotations (enumValueAnnotations);
532
519
enumDef.values ()->emplace_back (std::move (v));
533
520
}
534
- enumDef.annotations () = toRawAnnotations (annotations);
521
+ enumDef.annotations () = detail:: toRawAnnotations (annotations);
535
522
return enumDef;
536
523
}
537
524
@@ -540,7 +527,7 @@ TypeSystemBuilder::DefinitionHelper::OpaqueAlias(
540
527
TypeId targetType, const AnnotationsMap& annotations) {
541
528
SerializableOpaqueAliasDefinition def;
542
529
def.targetType () = targetType;
543
- def.annotations () = toRawAnnotations (annotations);
530
+ def.annotations () = detail:: toRawAnnotations (annotations);
544
531
return def;
545
532
}
546
533
0 commit comments