Skip to content

Commit

Permalink
Rust: matched_expr -> scrutinee
Browse files Browse the repository at this point in the history
  • Loading branch information
Paolo Tranquilli committed Nov 25, 2024
1 parent b47e961 commit 269ea75
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 44 deletions.
12 changes: 6 additions & 6 deletions rust/ql/.generated.list

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/ql/.gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -514,14 +514,14 @@ module ExprTrees {

class MatchExprTree extends PostOrderTree instanceof MatchExpr {
override predicate propagatesAbnormal(AstNode child) {
child = [super.getMatchedExpr(), super.getAnArm().getExpr()]
child = [super.getScrutinee(), super.getAnArm().getExpr()]
}

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

override predicate succ(AstNode pred, AstNode succ, Completion c) {
// Edge from the scrutinee to the first arm or to the match expression if no arms.
last(super.getMatchedExpr(), pred, c) and
last(super.getScrutinee(), pred, c) and
(
first(super.getArm(0).getPat(), succ)
or
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module Impl {
*/
class MatchExpr extends Generated::MatchExpr {
override string toString() {
result = "match " + this.getMatchedExpr().toAbbreviatedString() + " { ... }"
result = "match " + this.getScrutinee().toAbbreviatedString() + " { ... }"
}

/**
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions rust/ql/lib/codeql/rust/elements/internal/generated/Raw.qll

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
| gen_match_expr.rs:5:5:8:5 | match x { ... } | getNumberOfAttrs: | 0 | hasMatchedExpr: | yes | hasMatchArmList: | yes |
| gen_match_expr.rs:9:5:12:5 | match x { ... } | getNumberOfAttrs: | 0 | hasMatchedExpr: | yes | hasMatchArmList: | yes |
| gen_match_expr.rs:5:5:8:5 | match x { ... } | getNumberOfAttrs: | 0 | hasScrutinee: | yes | hasMatchArmList: | yes |
| gen_match_expr.rs:9:5:12:5 | match x { ... } | getNumberOfAttrs: | 0 | hasScrutinee: | yes | hasMatchArmList: | yes |
8 changes: 4 additions & 4 deletions rust/ql/test/extractor-tests/generated/MatchExpr/MatchExpr.ql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/schema/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class _:
}
```
"""
expr: _ | ql.name("matched_expr")
expr: _ | ql.name("scrutinee") | doc("scrutinee (the expression being matched) of this match expression")


@annotate(ContinueExpr, cfg = True)
Expand Down

0 comments on commit 269ea75

Please sign in to comment.