File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed
lib/codeql/rust/controlflow/internal
test/library-tests/controlflow Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -36,13 +36,7 @@ class SimpleCompletion extends NormalCompletion, TSimpleCompletion {
3636
3737 // `SimpleCompletion` is the "default" completion type, thus it is valid for
3838 // any node where there isn't another more specific completion type.
39- override predicate isValidFor ( AstNode e ) {
40- not any ( Completion c ) .isValidForSpecific ( e )
41- or
42- // A `?` expression can both proceed normally or cause an early return, so
43- // we explicitly allow the former here.
44- e instanceof TryExpr
45- }
39+ override predicate isValidFor ( AstNode e ) { not any ( Completion c ) .isValidForSpecific ( e ) }
4640
4741 override string toString ( ) { result = "simple" }
4842}
@@ -177,6 +171,8 @@ class MatchCompletion extends TMatchCompletion, ConditionalCompletion {
177171 override predicate isValidForSpecific ( AstNode e ) {
178172 e instanceof Pat and
179173 if isExhaustiveMatch ( e ) then value = true else any ( )
174+ or
175+ e instanceof TryExpr and value = true
180176 }
181177
182178 override MatchSuccessor getAMatchingSuccessorType ( ) { result .getValue ( ) = value }
Original file line number Diff line number Diff line change @@ -575,7 +575,7 @@ edges
575575| test.rs:263:9:263:11 | PathExpr | test.rs:263:9:263:26 | MethodCallExpr | |
576576| test.rs:263:9:263:26 | MethodCallExpr | test.rs:263:9:263:27 | TryExpr | |
577577| test.rs:263:9:263:27 | TryExpr | test.rs:262:5:264:5 | exit test_question_mark_operator_1 (normal) | return |
578- | test.rs:263:9:263:27 | TryExpr | test.rs:263:31:263:31 | 4 | |
578+ | test.rs:263:9:263:27 | TryExpr | test.rs:263:31:263:31 | 4 | match |
579579| test.rs:263:9:263:31 | ... + ... | test.rs:262:62:264:5 | BlockExpr | |
580580| test.rs:263:31:263:31 | 4 | test.rs:263:9:263:31 | ... + ... | |
581581| test.rs:266:5:271:5 | enter test_question_mark_operator_2 | test.rs:266:38:266:38 | b | |
@@ -586,7 +586,7 @@ edges
586586| test.rs:267:9:270:9 | MatchExpr | test.rs:266:71:271:5 | BlockExpr | |
587587| test.rs:267:15:267:15 | b | test.rs:267:15:267:16 | TryExpr | |
588588| test.rs:267:15:267:16 | TryExpr | test.rs:266:5:271:5 | exit test_question_mark_operator_2 (normal) | return |
589- | test.rs:267:15:267:16 | TryExpr | test.rs:268:13:268:16 | LiteralPat | |
589+ | test.rs:267:15:267:16 | TryExpr | test.rs:268:13:268:16 | LiteralPat | match |
590590| test.rs:268:13:268:16 | LiteralPat | test.rs:268:21:268:24 | PathExpr | match |
591591| test.rs:268:13:268:16 | LiteralPat | test.rs:269:13:269:17 | LiteralPat | no-match |
592592| test.rs:268:21:268:24 | PathExpr | test.rs:268:26:268:30 | false | |
You can’t perform that action at this time.
0 commit comments