Skip to content

Commit

Permalink
Rust: Use propagatesAbnormal in two places
Browse files Browse the repository at this point in the history
  • Loading branch information
hvitved committed Oct 1, 2024
1 parent c4eafb2 commit 8f0b7f0
Showing 1 changed file with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ class WhileExprTree extends LoopingExprTree instanceof WhileExpr {

override predicate entry(AstNode node) { this.first(node) }

override predicate propagatesAbnormal(AstNode child) { child = super.getCondition() }

override predicate first(AstNode node) { first(super.getCondition(), node) }

private ConditionalCompletion conditionCompletion(Completion c) {
Expand All @@ -388,13 +390,6 @@ class WhileExprTree extends LoopingExprTree instanceof WhileExpr {
this.conditionCompletion(c).failed() and
succ = this
}

override predicate last(AstNode last, Completion c) {
super.last(last, c)
or
last(super.getCondition(), last, c) and
not completionIsNormal(c)
}
}

class ForExprTree extends LoopingExprTree instanceof ForExpr {
Expand All @@ -404,6 +399,8 @@ class ForExprTree extends LoopingExprTree instanceof ForExpr {

override predicate entry(AstNode n) { first(super.getPat(), n) }

override predicate propagatesAbnormal(AstNode child) { child = super.getIterable() }

override predicate first(AstNode node) { first(super.getIterable(), node) }

override predicate succ(AstNode pred, AstNode succ, Completion c) {
Expand All @@ -421,13 +418,6 @@ class ForExprTree extends LoopingExprTree instanceof ForExpr {
c.(MatchCompletion).failed() and
succ = this
}

override predicate last(AstNode last, Completion c) {
super.last(last, c)
or
last(super.getIterable(), last, c) and
not completionIsNormal(c)
}
}

// TODO: replace with expanded macro once the extractor supports it
Expand Down

0 comments on commit 8f0b7f0

Please sign in to comment.