File tree Expand file tree Collapse file tree 2 files changed +71
-65
lines changed
lib/codeql/swift/controlflow/internal
test/library-tests/controlflow/graph Expand file tree Collapse file tree 2 files changed +71
-65
lines changed Original file line number Diff line number Diff line change @@ -265,11 +265,22 @@ private predicate isIrrefutableMatch(Pattern p) {
265265 isIrrefutableMatch ( p .getResolveStep ( ) )
266266}
267267
268+ /**
269+ * Holds if the ast node `ast` is a (possibly top-level) pattern that constantly matches (`value = true`) or
270+ * constantly non-matches (`value = false`).
271+ */
272+ private predicate isMatchingConstant ( AstNode ast , boolean value ) {
273+ isMatchingConstantItem ( ast , value )
274+ or
275+ isIrrefutableMatch ( ast ) and
276+ value = true
277+ }
278+
268279/**
269280 * Holds if the top-level pattern `cli` constantly matches (`value = true`) or
270281 * constantly non-matches (`value = false`).
271282 */
272- private predicate isMatchingConstant ( CaseLabelItem cli , boolean value ) {
283+ private predicate isMatchingConstantItem ( CaseLabelItem cli , boolean value ) {
273284 // If the pattern always matches
274285 isIrrefutableMatch ( cli .getPattern ( ) ) and
275286 (
You can’t perform that action at this time.
0 commit comments