From e071a25653ddb7bc77fa2c8168e744f779b03230 Mon Sep 17 00:00:00 2001 From: Kasper Svendsen Date: Wed, 3 May 2023 13:09:00 +0200 Subject: [PATCH] Java, C#: Make implicit this receivers explicit --- .../lib/semmle/code/csharp/dataflow/Bound.qll | 12 +++---- .../dataflow/internal/rangeanalysis/Sign.qll | 32 +++++++++---------- .../lib/semmle/code/java/dataflow/Bound.qll | 12 +++---- .../dataflow/internal/rangeanalysis/Sign.qll | 32 +++++++++---------- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/Bound.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/Bound.qll index 55a8b1f4c3f..b881161f66f 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/Bound.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/Bound.qll @@ -23,7 +23,7 @@ abstract class Bound extends TBound { abstract Expr getExpr(int delta); /** Gets an expression that equals this bound. */ - Expr getExpr() { result = getExpr(0) } + Expr getExpr() { result = this.getExpr(0) } /** * Holds if this element is at the specified location. @@ -54,12 +54,12 @@ class SsaBound extends Bound, TBoundSsa { /** Gets the SSA variable that equals this bound. */ SsaVariable getSsa() { this = TBoundSsa(result) } - override string toString() { result = getSsa().toString() } + override string toString() { result = this.getSsa().toString() } - override Expr getExpr(int delta) { result = getSsa().getAUse() and delta = 0 } + override Expr getExpr(int delta) { result = this.getSsa().getAUse() and delta = 0 } override predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) { - getSsa().getLocation().hasLocationInfo(path, sl, sc, el, ec) + this.getSsa().getLocation().hasLocationInfo(path, sl, sc, el, ec) } } @@ -68,11 +68,11 @@ class SsaBound extends Bound, TBoundSsa { * interesting, but isn't otherwise represented by the value of an SSA variable. */ class ExprBound extends Bound, TBoundExpr { - override string toString() { result = getExpr().toString() } + override string toString() { result = this.getExpr().toString() } override Expr getExpr(int delta) { this = TBoundExpr(result) and delta = 0 } override predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) { - getExpr().getLocation().hasLocationInfo(path, sl, sc, el, ec) + this.getExpr().getLocation().hasLocationInfo(path, sl, sc, el, ec) } } diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/Sign.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/Sign.qll index 649b4216996..30cc089f30b 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/Sign.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/Sign.qll @@ -90,7 +90,7 @@ class Sign extends TSign { * Gets a possible sign after subtracting an expression with sign `s` from an expression * that has this sign. */ - Sign sub(Sign s) { result = add(s.neg()) } + Sign sub(Sign s) { result = this.add(s.neg()) } /** * Gets a possible sign after multiplying an expression with sign `s` to an expression @@ -244,37 +244,37 @@ class Sign extends TSign { /** Perform `op` on this sign. */ Sign applyUnaryOp(TUnarySignOperation op) { - op = TIncOp() and result = inc() + op = TIncOp() and result = this.inc() or - op = TDecOp() and result = dec() + op = TDecOp() and result = this.dec() or - op = TNegOp() and result = neg() + op = TNegOp() and result = this.neg() or - op = TBitNotOp() and result = bitnot() + op = TBitNotOp() and result = this.bitnot() } /** Perform `op` on this sign and sign `s`. */ Sign applyBinaryOp(Sign s, TBinarySignOperation op) { - op = TAddOp() and result = add(s) + op = TAddOp() and result = this.add(s) or - op = TSubOp() and result = sub(s) + op = TSubOp() and result = this.sub(s) or - op = TMulOp() and result = mul(s) + op = TMulOp() and result = this.mul(s) or - op = TDivOp() and result = div(s) + op = TDivOp() and result = this.div(s) or - op = TRemOp() and result = rem(s) + op = TRemOp() and result = this.rem(s) or - op = TBitAndOp() and result = bitand(s) + op = TBitAndOp() and result = this.bitand(s) or - op = TBitOrOp() and result = bitor(s) + op = TBitOrOp() and result = this.bitor(s) or - op = TBitXorOp() and result = bitxor(s) + op = TBitXorOp() and result = this.bitxor(s) or - op = TLeftShiftOp() and result = lshift(s) + op = TLeftShiftOp() and result = this.lshift(s) or - op = TRightShiftOp() and result = rshift(s) + op = TRightShiftOp() and result = this.rshift(s) or - op = TUnsignedRightShiftOp() and result = urshift(s) + op = TUnsignedRightShiftOp() and result = this.urshift(s) } } diff --git a/java/ql/lib/semmle/code/java/dataflow/Bound.qll b/java/ql/lib/semmle/code/java/dataflow/Bound.qll index 55a8b1f4c3f..b881161f66f 100644 --- a/java/ql/lib/semmle/code/java/dataflow/Bound.qll +++ b/java/ql/lib/semmle/code/java/dataflow/Bound.qll @@ -23,7 +23,7 @@ abstract class Bound extends TBound { abstract Expr getExpr(int delta); /** Gets an expression that equals this bound. */ - Expr getExpr() { result = getExpr(0) } + Expr getExpr() { result = this.getExpr(0) } /** * Holds if this element is at the specified location. @@ -54,12 +54,12 @@ class SsaBound extends Bound, TBoundSsa { /** Gets the SSA variable that equals this bound. */ SsaVariable getSsa() { this = TBoundSsa(result) } - override string toString() { result = getSsa().toString() } + override string toString() { result = this.getSsa().toString() } - override Expr getExpr(int delta) { result = getSsa().getAUse() and delta = 0 } + override Expr getExpr(int delta) { result = this.getSsa().getAUse() and delta = 0 } override predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) { - getSsa().getLocation().hasLocationInfo(path, sl, sc, el, ec) + this.getSsa().getLocation().hasLocationInfo(path, sl, sc, el, ec) } } @@ -68,11 +68,11 @@ class SsaBound extends Bound, TBoundSsa { * interesting, but isn't otherwise represented by the value of an SSA variable. */ class ExprBound extends Bound, TBoundExpr { - override string toString() { result = getExpr().toString() } + override string toString() { result = this.getExpr().toString() } override Expr getExpr(int delta) { this = TBoundExpr(result) and delta = 0 } override predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) { - getExpr().getLocation().hasLocationInfo(path, sl, sc, el, ec) + this.getExpr().getLocation().hasLocationInfo(path, sl, sc, el, ec) } } diff --git a/java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/Sign.qll b/java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/Sign.qll index 649b4216996..30cc089f30b 100644 --- a/java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/Sign.qll +++ b/java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/Sign.qll @@ -90,7 +90,7 @@ class Sign extends TSign { * Gets a possible sign after subtracting an expression with sign `s` from an expression * that has this sign. */ - Sign sub(Sign s) { result = add(s.neg()) } + Sign sub(Sign s) { result = this.add(s.neg()) } /** * Gets a possible sign after multiplying an expression with sign `s` to an expression @@ -244,37 +244,37 @@ class Sign extends TSign { /** Perform `op` on this sign. */ Sign applyUnaryOp(TUnarySignOperation op) { - op = TIncOp() and result = inc() + op = TIncOp() and result = this.inc() or - op = TDecOp() and result = dec() + op = TDecOp() and result = this.dec() or - op = TNegOp() and result = neg() + op = TNegOp() and result = this.neg() or - op = TBitNotOp() and result = bitnot() + op = TBitNotOp() and result = this.bitnot() } /** Perform `op` on this sign and sign `s`. */ Sign applyBinaryOp(Sign s, TBinarySignOperation op) { - op = TAddOp() and result = add(s) + op = TAddOp() and result = this.add(s) or - op = TSubOp() and result = sub(s) + op = TSubOp() and result = this.sub(s) or - op = TMulOp() and result = mul(s) + op = TMulOp() and result = this.mul(s) or - op = TDivOp() and result = div(s) + op = TDivOp() and result = this.div(s) or - op = TRemOp() and result = rem(s) + op = TRemOp() and result = this.rem(s) or - op = TBitAndOp() and result = bitand(s) + op = TBitAndOp() and result = this.bitand(s) or - op = TBitOrOp() and result = bitor(s) + op = TBitOrOp() and result = this.bitor(s) or - op = TBitXorOp() and result = bitxor(s) + op = TBitXorOp() and result = this.bitxor(s) or - op = TLeftShiftOp() and result = lshift(s) + op = TLeftShiftOp() and result = this.lshift(s) or - op = TRightShiftOp() and result = rshift(s) + op = TRightShiftOp() and result = this.rshift(s) or - op = TUnsignedRightShiftOp() and result = urshift(s) + op = TUnsignedRightShiftOp() and result = this.urshift(s) } }