Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 11444a3

Browse files
committed
Rename Pattern to PatternExpr to avoid clashing with Regex::Pattern
1 parent 0236153 commit 11444a3

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,7 +1563,7 @@ class InstanceOfExpr extends Expr, @instanceofexpr {
15631563
/**
15641564
* Gets the pattern of an `x instanceof T pattern` expression, if any.
15651565
*/
1566-
Pattern getPattern() { result.isNthChildOf(this, 2) }
1566+
PatternExpr getPattern() { result.isNthChildOf(this, 2) }
15671567

15681568
/**
15691569
* Holds if this `instanceof` expression uses pattern matching.
@@ -2559,5 +2559,5 @@ class RecordPatternExpr extends Expr, @recordpatternexpr {
25592559
/**
25602560
* Gets the `i`th subpattern of this record pattern.
25612561
*/
2562-
Pattern getSubPattern(int i) { result.isNthChildOf(this, i) }
2562+
PatternExpr getSubPattern(int i) { result.isNthChildOf(this, i) }
25632563
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ class SwitchCase extends Stmt, @case {
504504
*/
505505
class ConstCase extends SwitchCase {
506506
ConstCase() {
507-
exists(Expr e | e.getParent() = this and e.getIndex() >= 0 and not e instanceof Pattern) and
507+
exists(Expr e | e.getParent() = this and e.getIndex() >= 0 and not e instanceof PatternExpr) and
508508
// For backward compatibility, we don't include `case null, default:` here, on the assumption
509509
// this will come as a surprise to CodeQL that predates that statement's validity.
510510
not isNullDefaultCase(this)
@@ -532,12 +532,12 @@ class ConstCase extends SwitchCase {
532532
*
533533
* Note binding patterns are represented as `LocalVariableDeclExpr`s.
534534
*/
535-
class Pattern extends Expr {
536-
Pattern() {
535+
class PatternExpr extends Expr {
536+
PatternExpr() {
537537
(
538538
this.getParent() instanceof SwitchCase or
539539
this.getParent() instanceof InstanceOfExpr or
540-
this.getParent() instanceof Pattern
540+
this.getParent() instanceof PatternExpr
541541
) and
542542
(this instanceof LocalVariableDeclExpr or this instanceof RecordPatternExpr)
543543
}
@@ -555,12 +555,12 @@ class Pattern extends Expr {
555555

556556
/** A pattern case of a `switch` statement */
557557
class PatternCase extends SwitchCase {
558-
Pattern pattern;
558+
PatternExpr pattern;
559559

560560
PatternCase() { pattern.isNthChildOf(this, 0) }
561561

562562
/** Gets this case's pattern. */
563-
Pattern getPattern() { result.isNthChildOf(this, 0) }
563+
PatternExpr getPattern() { result = pattern }
564564

565565
/** Gets the guard applicable to this pattern case, if any. */
566566
Expr getGuard() { result.isNthChildOf(this, -3) }

java/ql/lib/semmle/code/java/dataflow/internal/DataFlowPrivate.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ predicate readStep(Node node1, ContentSet f, Node node2) {
267267
node2.asExpr() = get
268268
)
269269
or
270-
exists(RecordPatternExpr rpe, Pattern subPattern, int i |
270+
exists(RecordPatternExpr rpe, PatternExpr subPattern, int i |
271271
node1.asExpr() = rpe and
272272
subPattern = rpe.getSubPattern(i) and
273273
node2.asExpr() = subPattern and

java/ql/lib/semmle/code/java/dataflow/internal/DataFlowUtil.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ private predicate simpleLocalFlowStep0(Node node1, Node node2) {
204204
exists(SsaExplicitUpdate upd |
205205
upd.getDefiningExpr().(VariableAssign).getSource() = node1.asExpr() or
206206
upd.getDefiningExpr().(AssignOp) = node1.asExpr() or
207-
upd.getDefiningExpr().(Pattern).asBindingPattern() = node1.asExpr()
207+
upd.getDefiningExpr().(PatternExpr).asBindingPattern() = node1.asExpr()
208208
|
209209
node2.asExpr() = upd.getAFirstUse() and
210210
not capturedVariableRead(node2)

0 commit comments

Comments
 (0)