@@ -101,7 +101,7 @@ class Completion extends TCompletion {
101101 or
102102 not isNullnessConstant ( cfe , _) and
103103 this = TNullnessCompletion ( _)
104- else if mustHaveMatchingCompletion ( _ , cfe ) then
104+ else if mustHaveMatchingCompletion ( cfe ) then
105105 exists ( boolean value |
106106 isMatchingConstant ( cfe , value ) |
107107 this = TMatchingCompletion ( value )
@@ -123,11 +123,6 @@ class Completion extends TCompletion {
123123 this instanceof NormalCompletion or
124124 this instanceof ContinueCompletion
125125 }
126-
127- /** Holds if this completion is a valid completion for exiting a callable. */
128- predicate isValidCallableExitCompletion ( ) {
129- not this instanceof GotoCompletion
130- }
131126}
132127
133128/** Holds if expression `e` has the Boolean constant value `value`. */
@@ -319,6 +314,11 @@ private predicate inBooleanContext(Expr e, boolean isBooleanCompletionForParent)
319314 isBooleanCompletionForParent = false
320315 )
321316 or
317+ exists ( SpecificCatchClause scc |
318+ scc .getFilterClause ( ) = e |
319+ isBooleanCompletionForParent = false
320+ )
321+ or
322322 exists ( LogicalNotExpr lne |
323323 lne .getAnOperand ( ) = e |
324324 inBooleanContext ( lne , _) and
@@ -401,14 +401,20 @@ private predicate inNullnessContext(Expr e, boolean isNullnessCompletionForParen
401401 )
402402}
403403
404+ private predicate mustHaveMatchingCompletion ( SwitchStmt ss , ControlFlowElement cfe ) {
405+ cfe = ss .getAConstCase ( ) .getExpr ( )
406+ or
407+ cfe = ss .getATypeCase ( ) .getTypeAccess ( ) // use type access to represent the type test
408+ }
409+
404410/**
405- * Holds if a normal completion of `e ` must be a matching completion. Thats is,
406- * whether `e ` determines a match in a `switch` statement.
411+ * Holds if a normal completion of `cfe ` must be a matching completion. Thats is,
412+ * whether `cfe ` determines a match in a `switch` statement or `catch` clause .
407413 */
408- private predicate mustHaveMatchingCompletion ( SwitchStmt ss , Expr e ) {
409- e = ss . getAConstCase ( ) . getExpr ( )
414+ private predicate mustHaveMatchingCompletion ( ControlFlowElement cfe ) {
415+ mustHaveMatchingCompletion ( _ , cfe )
410416 or
411- e = ss . getATypeCase ( ) . getTypeAccess ( ) // use type access to represent the type test
417+ cfe instanceof SpecificCatchClause
412418}
413419
414420/**
0 commit comments