mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
Revert getNonIntegerValue unification
This commit is contained in:
@@ -41,18 +41,6 @@ private Sign certainExprSign(Expr e) {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the expression if it can't be converted to integer, but
|
||||
* can be converted to float.
|
||||
*/
|
||||
private float getNonIntegerValue(ExprWithPossibleValue e) {
|
||||
exists(string s |
|
||||
s = e.getValue() and
|
||||
result = s.toFloat() and
|
||||
not exists(s.toInt())
|
||||
)
|
||||
}
|
||||
|
||||
/** Holds if the sign of `e` is too complicated to determine. */
|
||||
private predicate unknownSign(Expr e) {
|
||||
not exists(certainExprSign(e)) and
|
||||
|
||||
@@ -35,8 +35,6 @@ module Private {
|
||||
|
||||
class VariableUpdate = CS::AssignableDefinition;
|
||||
|
||||
class ExprWithPossibleValue = CS::Expr;
|
||||
|
||||
class Field = CS::Field;
|
||||
|
||||
class RealLiteral = CS::RealLiteral;
|
||||
@@ -130,6 +128,15 @@ private module Impl {
|
||||
/** Gets the character value of expression `e`. */
|
||||
string getCharValue(Expr e) { result = e.getValue() and e.getType() instanceof CharType }
|
||||
|
||||
/** Gets the constant `float` value of non-`ConstantIntegerExpr` expressions. */
|
||||
float getNonIntegerValue(Expr e) {
|
||||
exists(string s |
|
||||
s = e.getValue() and
|
||||
result = s.toFloat() and
|
||||
not exists(s.toInt())
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `e` is an access to the size of a container (`string`, `Array`,
|
||||
* `IEnumerable`, or `ICollection`).
|
||||
|
||||
@@ -41,18 +41,6 @@ private Sign certainExprSign(Expr e) {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the expression if it can't be converted to integer, but
|
||||
* can be converted to float.
|
||||
*/
|
||||
private float getNonIntegerValue(ExprWithPossibleValue e) {
|
||||
exists(string s |
|
||||
s = e.getValue() and
|
||||
result = s.toFloat() and
|
||||
not exists(s.toInt())
|
||||
)
|
||||
}
|
||||
|
||||
/** Holds if the sign of `e` is too complicated to determine. */
|
||||
private predicate unknownSign(Expr e) {
|
||||
not exists(certainExprSign(e)) and
|
||||
|
||||
@@ -39,8 +39,6 @@ module Private {
|
||||
|
||||
class VariableUpdate = J::VariableUpdate;
|
||||
|
||||
class ExprWithPossibleValue = J::Literal;
|
||||
|
||||
class Field = J::Field;
|
||||
|
||||
class DivExpr = J::DivExpr;
|
||||
@@ -187,6 +185,13 @@ private module Impl {
|
||||
/** Gets the character value of expression `e`. */
|
||||
string getCharValue(Expr e) { result = e.(CharacterLiteral).getValue() }
|
||||
|
||||
/** Gets the constant `float` value of non-`ConstantIntegerExpr` expressions. */
|
||||
float getNonIntegerValue(Expr e) {
|
||||
result = e.(LongLiteral).getValue().toFloat() or
|
||||
result = e.(FloatingPointLiteral).getValue().toFloat() or
|
||||
result = e.(DoubleLiteral).getValue().toFloat()
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `e` is an access to the size of a container (`string`, `Map`, or
|
||||
* `Collection`).
|
||||
|
||||
Reference in New Issue
Block a user