Skip to content

Commit d88ae8d

Browse files
thedavekwonfacebook-github-bot
authored andcommitted
Add annotations method in TypeSystem nodes
Summary: add annotations method to get the map directly Reviewed By: pranavtbhat Differential Revision: D79856931 fbshipit-source-id: 15edf3a0fe4c972122771854428655cce62109cb
1 parent e27994b commit d88ae8d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

third-party/thrift/src/thrift/lib/cpp2/dynamic/TypeSystem.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,8 @@ class FieldDefinition final : folly::MoveOnly {
854854
: nullptr;
855855
}
856856

857+
const AnnotationsMap& annotations() const noexcept { return annotations_; }
858+
857859
const SerializableRecord* getAnnotationOrNull(UriView uri) const {
858860
return folly::get_ptr(annotations_, uri);
859861
}
@@ -984,6 +986,8 @@ class StructuredNode : public DefinitionNode {
984986
return FastFieldHandle::invalid();
985987
}
986988

989+
const AnnotationsMap& annotations() const noexcept { return annotations_; }
990+
987991
const SerializableRecord* getAnnotationOrNull(UriView uri) const {
988992
return folly::get_ptr(annotations_, uri);
989993
}
@@ -1033,13 +1037,16 @@ class EnumNode final : folly::MoveOnly, public DefinitionNode {
10331037
friend bool operator!=(const Value& lhs, const Value& rhs) noexcept {
10341038
return !(lhs == rhs);
10351039
}
1040+
const AnnotationsMap& annotations() const noexcept { return annotations_; }
10361041
const SerializableRecord* getAnnotationOrNull(UriView uri) const {
10371042
return folly::get_ptr(annotations_, uri);
10381043
}
10391044
};
10401045

10411046
folly::span<const Value> values() const noexcept { return values_; }
10421047

1048+
const AnnotationsMap& annotations() const noexcept { return annotations_; }
1049+
10431050
const SerializableRecord* getAnnotationOrNull(UriView uri) const {
10441051
return folly::get_ptr(annotations_, uri);
10451052
}
@@ -1059,6 +1066,8 @@ class OpaqueAliasNode final : folly::MoveOnly, public DefinitionNode {
10591066
public:
10601067
const TypeRef& targetType() const noexcept { return targetType_; }
10611068

1069+
const AnnotationsMap& annotations() const noexcept { return annotations_; }
1070+
10621071
const SerializableRecord* getAnnotationOrNull(UriView uri) const {
10631072
return folly::get_ptr(annotations_, uri);
10641073
}

0 commit comments

Comments
 (0)