Skip to content

Commit

Permalink
Unblock relay lsp
Browse files Browse the repository at this point in the history
Reviewed By: evanyeung

Differential Revision: D67654852

fbshipit-source-id: aa19edd1a8d741aabc603d898828c90a9bf2d713
  • Loading branch information
tyao1 authored and facebook-github-bot committed Dec 27, 2024
1 parent 7897487 commit fe5b82c
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions compiler/crates/relay-transforms/src/required_directive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ impl<'program> RequiredDirective<'program> {
}
}

impl<'s> Transformer<'_> for RequiredDirective<'s> {
impl Transformer<'_> for RequiredDirective<'_> {
const NAME: &'static str = "RequiredDirectiveTransform";
const VISIT_ARGUMENTS: bool = false;
const VISIT_DIRECTIVES: bool = false;
Expand Down Expand Up @@ -592,21 +592,26 @@ struct RequiredDirectiveVisitor<'s> {
visited_fragments: FragmentDefinitionNameMap<bool>,
}

impl<'s> DirectiveFinder for RequiredDirectiveVisitor<'s> {
impl DirectiveFinder for RequiredDirectiveVisitor<'_> {
fn visit_directive(&self, directive: &Directive) -> bool {
directive.name.item == *REQUIRED_DIRECTIVE_NAME
}

fn visit_fragment_spread(&mut self, fragment_spread: &graphql_ir::FragmentSpread) -> bool {
let fragment = self
.program
.fragment(fragment_spread.fragment.item)
.unwrap();
self.visit_fragment(fragment)
let fragment = self.program.fragment(fragment_spread.fragment.item);
if let Some(frag) = fragment {
self.visit_fragment(frag)
} else {
println!(
"required_directive: Could not find fragment for fragment spread: {}",
fragment_spread.fragment.item
);
false
}
}
}

impl<'s> RequiredDirectiveVisitor<'s> {
impl RequiredDirectiveVisitor<'_> {
fn visit_fragment(&mut self, fragment: &FragmentDefinition) -> bool {
if let Some(val) = self.visited_fragments.get(&fragment.name.item) {
return *val;
Expand Down

0 comments on commit fe5b82c

Please sign in to comment.