Skip to content

Commit e071a25

Browse files
committed
Java, C#: Make implicit this receivers explicit
1 parent e9c2594 commit e071a25

File tree

4 files changed

+44
-44
lines changed

4 files changed

+44
-44
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/Bound.qll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ abstract class Bound extends TBound {
2323
abstract Expr getExpr(int delta);
2424

2525
/** Gets an expression that equals this bound. */
26-
Expr getExpr() { result = getExpr(0) }
26+
Expr getExpr() { result = this.getExpr(0) }
2727

2828
/**
2929
* Holds if this element is at the specified location.
@@ -54,12 +54,12 @@ class SsaBound extends Bound, TBoundSsa {
5454
/** Gets the SSA variable that equals this bound. */
5555
SsaVariable getSsa() { this = TBoundSsa(result) }
5656

57-
override string toString() { result = getSsa().toString() }
57+
override string toString() { result = this.getSsa().toString() }
5858

59-
override Expr getExpr(int delta) { result = getSsa().getAUse() and delta = 0 }
59+
override Expr getExpr(int delta) { result = this.getSsa().getAUse() and delta = 0 }
6060

6161
override predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) {
62-
getSsa().getLocation().hasLocationInfo(path, sl, sc, el, ec)
62+
this.getSsa().getLocation().hasLocationInfo(path, sl, sc, el, ec)
6363
}
6464
}
6565

@@ -68,11 +68,11 @@ class SsaBound extends Bound, TBoundSsa {
6868
* interesting, but isn't otherwise represented by the value of an SSA variable.
6969
*/
7070
class ExprBound extends Bound, TBoundExpr {
71-
override string toString() { result = getExpr().toString() }
71+
override string toString() { result = this.getExpr().toString() }
7272

7373
override Expr getExpr(int delta) { this = TBoundExpr(result) and delta = 0 }
7474

7575
override predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) {
76-
getExpr().getLocation().hasLocationInfo(path, sl, sc, el, ec)
76+
this.getExpr().getLocation().hasLocationInfo(path, sl, sc, el, ec)
7777
}
7878
}

csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/Sign.qll

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Sign extends TSign {
9090
* Gets a possible sign after subtracting an expression with sign `s` from an expression
9191
* that has this sign.
9292
*/
93-
Sign sub(Sign s) { result = add(s.neg()) }
93+
Sign sub(Sign s) { result = this.add(s.neg()) }
9494

9595
/**
9696
* Gets a possible sign after multiplying an expression with sign `s` to an expression
@@ -244,37 +244,37 @@ class Sign extends TSign {
244244

245245
/** Perform `op` on this sign. */
246246
Sign applyUnaryOp(TUnarySignOperation op) {
247-
op = TIncOp() and result = inc()
247+
op = TIncOp() and result = this.inc()
248248
or
249-
op = TDecOp() and result = dec()
249+
op = TDecOp() and result = this.dec()
250250
or
251-
op = TNegOp() and result = neg()
251+
op = TNegOp() and result = this.neg()
252252
or
253-
op = TBitNotOp() and result = bitnot()
253+
op = TBitNotOp() and result = this.bitnot()
254254
}
255255

256256
/** Perform `op` on this sign and sign `s`. */
257257
Sign applyBinaryOp(Sign s, TBinarySignOperation op) {
258-
op = TAddOp() and result = add(s)
258+
op = TAddOp() and result = this.add(s)
259259
or
260-
op = TSubOp() and result = sub(s)
260+
op = TSubOp() and result = this.sub(s)
261261
or
262-
op = TMulOp() and result = mul(s)
262+
op = TMulOp() and result = this.mul(s)
263263
or
264-
op = TDivOp() and result = div(s)
264+
op = TDivOp() and result = this.div(s)
265265
or
266-
op = TRemOp() and result = rem(s)
266+
op = TRemOp() and result = this.rem(s)
267267
or
268-
op = TBitAndOp() and result = bitand(s)
268+
op = TBitAndOp() and result = this.bitand(s)
269269
or
270-
op = TBitOrOp() and result = bitor(s)
270+
op = TBitOrOp() and result = this.bitor(s)
271271
or
272-
op = TBitXorOp() and result = bitxor(s)
272+
op = TBitXorOp() and result = this.bitxor(s)
273273
or
274-
op = TLeftShiftOp() and result = lshift(s)
274+
op = TLeftShiftOp() and result = this.lshift(s)
275275
or
276-
op = TRightShiftOp() and result = rshift(s)
276+
op = TRightShiftOp() and result = this.rshift(s)
277277
or
278-
op = TUnsignedRightShiftOp() and result = urshift(s)
278+
op = TUnsignedRightShiftOp() and result = this.urshift(s)
279279
}
280280
}

java/ql/lib/semmle/code/java/dataflow/Bound.qll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ abstract class Bound extends TBound {
2323
abstract Expr getExpr(int delta);
2424

2525
/** Gets an expression that equals this bound. */
26-
Expr getExpr() { result = getExpr(0) }
26+
Expr getExpr() { result = this.getExpr(0) }
2727

2828
/**
2929
* Holds if this element is at the specified location.
@@ -54,12 +54,12 @@ class SsaBound extends Bound, TBoundSsa {
5454
/** Gets the SSA variable that equals this bound. */
5555
SsaVariable getSsa() { this = TBoundSsa(result) }
5656

57-
override string toString() { result = getSsa().toString() }
57+
override string toString() { result = this.getSsa().toString() }
5858

59-
override Expr getExpr(int delta) { result = getSsa().getAUse() and delta = 0 }
59+
override Expr getExpr(int delta) { result = this.getSsa().getAUse() and delta = 0 }
6060

6161
override predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) {
62-
getSsa().getLocation().hasLocationInfo(path, sl, sc, el, ec)
62+
this.getSsa().getLocation().hasLocationInfo(path, sl, sc, el, ec)
6363
}
6464
}
6565

@@ -68,11 +68,11 @@ class SsaBound extends Bound, TBoundSsa {
6868
* interesting, but isn't otherwise represented by the value of an SSA variable.
6969
*/
7070
class ExprBound extends Bound, TBoundExpr {
71-
override string toString() { result = getExpr().toString() }
71+
override string toString() { result = this.getExpr().toString() }
7272

7373
override Expr getExpr(int delta) { this = TBoundExpr(result) and delta = 0 }
7474

7575
override predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) {
76-
getExpr().getLocation().hasLocationInfo(path, sl, sc, el, ec)
76+
this.getExpr().getLocation().hasLocationInfo(path, sl, sc, el, ec)
7777
}
7878
}

java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/Sign.qll

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Sign extends TSign {
9090
* Gets a possible sign after subtracting an expression with sign `s` from an expression
9191
* that has this sign.
9292
*/
93-
Sign sub(Sign s) { result = add(s.neg()) }
93+
Sign sub(Sign s) { result = this.add(s.neg()) }
9494

9595
/**
9696
* Gets a possible sign after multiplying an expression with sign `s` to an expression
@@ -244,37 +244,37 @@ class Sign extends TSign {
244244

245245
/** Perform `op` on this sign. */
246246
Sign applyUnaryOp(TUnarySignOperation op) {
247-
op = TIncOp() and result = inc()
247+
op = TIncOp() and result = this.inc()
248248
or
249-
op = TDecOp() and result = dec()
249+
op = TDecOp() and result = this.dec()
250250
or
251-
op = TNegOp() and result = neg()
251+
op = TNegOp() and result = this.neg()
252252
or
253-
op = TBitNotOp() and result = bitnot()
253+
op = TBitNotOp() and result = this.bitnot()
254254
}
255255

256256
/** Perform `op` on this sign and sign `s`. */
257257
Sign applyBinaryOp(Sign s, TBinarySignOperation op) {
258-
op = TAddOp() and result = add(s)
258+
op = TAddOp() and result = this.add(s)
259259
or
260-
op = TSubOp() and result = sub(s)
260+
op = TSubOp() and result = this.sub(s)
261261
or
262-
op = TMulOp() and result = mul(s)
262+
op = TMulOp() and result = this.mul(s)
263263
or
264-
op = TDivOp() and result = div(s)
264+
op = TDivOp() and result = this.div(s)
265265
or
266-
op = TRemOp() and result = rem(s)
266+
op = TRemOp() and result = this.rem(s)
267267
or
268-
op = TBitAndOp() and result = bitand(s)
268+
op = TBitAndOp() and result = this.bitand(s)
269269
or
270-
op = TBitOrOp() and result = bitor(s)
270+
op = TBitOrOp() and result = this.bitor(s)
271271
or
272-
op = TBitXorOp() and result = bitxor(s)
272+
op = TBitXorOp() and result = this.bitxor(s)
273273
or
274-
op = TLeftShiftOp() and result = lshift(s)
274+
op = TLeftShiftOp() and result = this.lshift(s)
275275
or
276-
op = TRightShiftOp() and result = rshift(s)
276+
op = TRightShiftOp() and result = this.rshift(s)
277277
or
278-
op = TUnsignedRightShiftOp() and result = urshift(s)
278+
op = TUnsignedRightShiftOp() and result = this.urshift(s)
279279
}
280280
}

0 commit comments

Comments
 (0)