Skip to content

Commit c7cb885

Browse files
committed
Add missing javadoc and getUniquePattern predicate
1 parent f44bece commit c7cb885

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

java/ql/lib/semmle/code/java/Statement.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,16 @@ class PatternCase extends SwitchCase {
551551
*/
552552
PatternExpr getPatternAtIndex(int n) { result.isNthChildOf(this, n) }
553553

554+
/**
555+
* Gets any of this case's patterns.
556+
*/
554557
PatternExpr getAPattern() { result = this.getPatternAtIndex(_) }
555558

559+
/**
560+
* Gets this case's sole pattern, if there is exactly one.
561+
*/
562+
PatternExpr getUniquePattern() { result = unique(PatternExpr pe | pe = this.getPatternAtIndex(_)) }
563+
556564
/** Gets the guard applicable to this pattern case, if any. */
557565
Expr getGuard() { result.isNthChildOf(this, -3) }
558566

0 commit comments

Comments
 (0)