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

Skip to content

Commit f138ba5

Browse files
committed
C#/Kotlin: Sync SignAnalysisCommon.qll
1 parent 9f294d1 commit f138ba5

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private predicate unknownSign(Expr e) {
4949
or
5050
exists(LongLiteral lit | lit = e and not exists(lit.getValue().toFloat()))
5151
or
52-
exists(CastExpr cast, Type fromtyp |
52+
exists(CastingExpr cast, Type fromtyp |
5353
cast = e and
5454
fromtyp = cast.getSourceType() and
5555
not fromtyp instanceof NumericOrCharType

csharp/ql/lib/semmle/code/csharp/exprs/Expr.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,14 @@ class AsExpr extends Cast, @as_expr {
710710
override string getAPrimaryQlClass() { result = "AsExpr" }
711711
}
712712

713+
/**
714+
* Any kind of expression that casts values from one type to another.
715+
*
716+
* For C#, this is only `CastExpr`.
717+
*/
718+
class CastingExpr extends CastExpr {
719+
}
720+
713721
/**
714722
* A cast expression, for example `(string) x`.
715723
*/

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,12 @@ class LogNotExpr extends UnaryExpr, @lognotexpr {
12071207
override string getAPrimaryQlClass() { result = "LogNotExpr" }
12081208
}
12091209

1210+
/**
1211+
* Any kind of expression that casts values from one type to another.
1212+
*
1213+
* For Java, this is only `CastExpr`, but for Kotlin it includes
1214+
* various other explicit or implicit casting operators.
1215+
*/
12101216
class CastingExpr extends Expr {
12111217
CastingExpr() {
12121218
this instanceof @castexpr or

0 commit comments

Comments
 (0)