mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
Distinguish record patterns that do or don't declare identifiers
This commit is contained in:
@@ -2739,4 +2739,14 @@ class RecordPatternExpr extends Expr, @recordpatternexpr {
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if this record pattern declares any identifiers (i.e., at least one leaf declaration is named).
|
||||
*/
|
||||
predicate declaresAnyIdentifiers() {
|
||||
exists(PatternExpr subPattern | subPattern = this.getSubPattern(_) |
|
||||
subPattern.asRecordPattern().declaresAnyIdentifiers() or
|
||||
not subPattern.asBindingOrUnnamedPattern().isAnonymous()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user