mirror of
https://github.com/github/codeql.git
synced 2026-05-13 02:39:26 +02:00
patch upper-case acronyms to be PascalCase
This commit is contained in:
@@ -24,7 +24,7 @@ private import semmle.javascript.DefensiveProgramming
|
||||
* Besides the usual comparison operators, `switch` statements are also considered to be comparisons,
|
||||
* with the switched-on expression being the right operand and all case labels the left operands.
|
||||
*/
|
||||
predicate comparisonOperands(ASTNode nd, Expr left, Expr right) {
|
||||
predicate comparisonOperands(AstNode nd, Expr left, Expr right) {
|
||||
exists(Comparison cmp | cmp = nd | left = cmp.getLeftOperand() and right = cmp.getRightOperand())
|
||||
or
|
||||
exists(SwitchStmt switch | switch = nd |
|
||||
@@ -45,7 +45,7 @@ predicate hasImplicitConversionMethod(DefiniteAbstractValue av) {
|
||||
/**
|
||||
* Gets a type of `operand`, which is an operand of the strict equality test `eq`.
|
||||
*/
|
||||
InferredType strictEqualityOperandType(ASTNode eq, DataFlow::AnalyzedNode operand) {
|
||||
InferredType strictEqualityOperandType(AstNode eq, DataFlow::AnalyzedNode operand) {
|
||||
// strict equality tests do no conversion at all
|
||||
operand.asExpr() = eq.(StrictEqualityTest).getAChildExpr() and result = operand.getAType()
|
||||
or
|
||||
@@ -60,7 +60,7 @@ InferredType strictEqualityOperandType(ASTNode eq, DataFlow::AnalyzedNode operan
|
||||
* Holds if `operand` is an operand of the non-strict equality test or relational
|
||||
* operator `parent`, and may have a `toString` or `valueOf` method.
|
||||
*/
|
||||
predicate implicitlyConvertedOperand(ASTNode parent, DataFlow::AnalyzedNode operand) {
|
||||
predicate implicitlyConvertedOperand(AstNode parent, DataFlow::AnalyzedNode operand) {
|
||||
(parent instanceof NonStrictEqualityTest or parent instanceof RelationalComparison) and
|
||||
operand.asExpr() = parent.getAChildExpr() and
|
||||
hasImplicitConversionMethod(operand.getAValue())
|
||||
@@ -70,7 +70,7 @@ predicate implicitlyConvertedOperand(ASTNode parent, DataFlow::AnalyzedNode oper
|
||||
* Gets a type of `operand`, which is an operand of the non-strict equality test or
|
||||
* relational operator `parent`.
|
||||
*/
|
||||
InferredType nonStrictOperandType(ASTNode parent, DataFlow::AnalyzedNode operand) {
|
||||
InferredType nonStrictOperandType(AstNode parent, DataFlow::AnalyzedNode operand) {
|
||||
// non-strict equality tests perform conversions
|
||||
operand.asExpr() = parent.(NonStrictEqualityTest).getAChildExpr() and
|
||||
exists(InferredType tp | tp = operand.getAValue().getType() |
|
||||
@@ -109,7 +109,7 @@ InferredType nonStrictOperandType(ASTNode parent, DataFlow::AnalyzedNode operand
|
||||
* Gets a type that `operand`, which is an operand of comparison `parent`,
|
||||
* could be converted to at runtime.
|
||||
*/
|
||||
InferredType convertedOperandType(ASTNode parent, DataFlow::AnalyzedNode operand) {
|
||||
InferredType convertedOperandType(AstNode parent, DataFlow::AnalyzedNode operand) {
|
||||
result = strictEqualityOperandType(parent, operand)
|
||||
or
|
||||
// if `operand` might have `toString`/`valueOf`, just assume it could
|
||||
@@ -125,7 +125,7 @@ InferredType convertedOperandType(ASTNode parent, DataFlow::AnalyzedNode operand
|
||||
* common type they coerce to.
|
||||
*/
|
||||
predicate isHeterogeneousComparison(
|
||||
ASTNode cmp, DataFlow::AnalyzedNode left, DataFlow::AnalyzedNode right, string leftTypes,
|
||||
AstNode cmp, DataFlow::AnalyzedNode left, DataFlow::AnalyzedNode right, string leftTypes,
|
||||
string rightTypes
|
||||
) {
|
||||
comparisonOperands(cmp, left.asExpr(), right.asExpr()) and
|
||||
@@ -188,7 +188,7 @@ predicate isInitialParameterUse(Expr e) {
|
||||
predicate whitelist(Expr e) { isInitialParameterUse(e) }
|
||||
|
||||
from
|
||||
ASTNode cmp, DataFlow::AnalyzedNode left, DataFlow::AnalyzedNode right, string leftTypes,
|
||||
AstNode cmp, DataFlow::AnalyzedNode left, DataFlow::AnalyzedNode right, string leftTypes,
|
||||
string rightTypes, string leftExprDescription, string rightExprDescription, int leftTypeCount,
|
||||
int rightTypeCount, string leftTypeDescription, string rightTypeDescription
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user