Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
chore: flip conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
kaioduarte committed Jan 4, 2023
1 parent 48a9bb4 commit 10b2a34
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions crates/rome_js_analyze/src/analyzers/nursery/use_yield.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ impl Visitor for MissingYieldVisitor {
self.stack.push((node, false));
}

if let Some((_, has_yield)) = self.stack.last_mut() {
if JsYieldExpression::can_cast(node.kind()) {
// When the visitor enters a `yield` expression, set the
// `has_yield` flag for the top entry on the stack to `true`
if JsYieldExpression::can_cast(node.kind()) {
if let Some((_, has_yield)) = self.stack.last_mut() {
*has_yield = true;
}
}
Expand All @@ -117,8 +117,7 @@ impl Visitor for MissingYieldVisitor {
// entry of the stack and the `has_yield` flag is `false`, emit a query match
if let Some(exit_node) = AnyFunctionLike::cast_ref(node) {
if let Some((enter_node, has_yield)) = self.stack.pop() {
debug_assert_eq!(enter_node, exit_node);
if !has_yield {
if enter_node == exit_node && !has_yield {
ctx.match_query(MissingYield(enter_node));
}
}
Expand Down

0 comments on commit 10b2a34

Please sign in to comment.