Skip to content

Commit

Permalink
Add FlatbufferSchema.has_type()
Browse files Browse the repository at this point in the history
Reviewed By: ginfung

Differential Revision: D33409610

fbshipit-source-id: 960032bb5114e51f07115aef8fd25118db48a68e
  • Loading branch information
Steven Chaitoff authored and facebook-github-bot committed Jan 5, 2022
1 parent ebfa5b1 commit 2ea681c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions compiler/crates/schema/src/flatbuffer/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ impl SchemaWrapper {
result
}

pub fn has_type(&self, type_name: StringKey) -> bool {
self.flatbuffer_schema().has_type(type_name)
}

pub fn has_directive(&self, name: StringKey) -> bool {
self.get_directive(name).is_some()
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/crates/schema/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ impl SDLSchema {

pub fn has_type(&self, type_name: StringKey) -> bool {
match self {
SDLSchema::FlatBuffer(_schema) => todo!(),
SDLSchema::FlatBuffer(schema) => schema.has_type(type_name),
SDLSchema::InMemory(schema) => schema.has_type(type_name),
}
}
Expand Down

0 comments on commit 2ea681c

Please sign in to comment.