mirror of
https://github.com/github/codeql.git
synced 2026-04-27 01:35:13 +02:00
Java/C#/GO: Use instanceof in more places
This commit is contained in:
@@ -53,9 +53,7 @@ class SuppressionComment extends Javadoc {
|
||||
/**
|
||||
* The scope of an alert suppression comment.
|
||||
*/
|
||||
class SuppressionScope extends @javadoc {
|
||||
SuppressionScope() { this instanceof SuppressionComment }
|
||||
|
||||
class SuppressionScope extends @javadoc instanceof SuppressionComment {
|
||||
/** Gets a suppression comment with this scope. */
|
||||
SuppressionComment getSuppressionComment() { result = this }
|
||||
|
||||
@@ -69,7 +67,7 @@ class SuppressionScope extends @javadoc {
|
||||
predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
this.(SuppressionComment).covers(filepath, startline, startcolumn, endline, endcolumn)
|
||||
super.covers(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
|
||||
/** Gets a textual representation of this element. */
|
||||
|
||||
@@ -69,9 +69,7 @@ class SuppressionAnnotation extends SuppressWarningsAnnotation {
|
||||
/**
|
||||
* The scope of an alert suppression annotation.
|
||||
*/
|
||||
class SuppressionScope extends @annotation {
|
||||
SuppressionScope() { this instanceof SuppressionAnnotation }
|
||||
|
||||
class SuppressionScope extends @annotation instanceof SuppressionAnnotation {
|
||||
/** Gets a suppression annotation with this scope. */
|
||||
SuppressionAnnotation getSuppressionAnnotation() { result = this }
|
||||
|
||||
@@ -85,7 +83,7 @@ class SuppressionScope extends @annotation {
|
||||
predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
this.(SuppressionAnnotation).covers(filepath, startline, startcolumn, endline, endcolumn)
|
||||
super.covers(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
|
||||
/** Gets a textual representation of this element. */
|
||||
|
||||
@@ -20,9 +20,7 @@ int leftWidth(ComparisonExpr e) { result = e.getLeftOperand().getType().(NumType
|
||||
|
||||
int rightWidth(ComparisonExpr e) { result = e.getRightOperand().getType().(NumType).getWidthRank() }
|
||||
|
||||
abstract class WideningComparison extends BinaryExpr {
|
||||
WideningComparison() { this instanceof ComparisonExpr }
|
||||
|
||||
abstract class WideningComparison extends BinaryExpr instanceof ComparisonExpr {
|
||||
abstract Expr getNarrower();
|
||||
|
||||
abstract Expr getWider();
|
||||
|
||||
@@ -81,8 +81,7 @@ private class CompareSink extends ClientSuppliedIpUsedInSecurityCheckSink {
|
||||
}
|
||||
|
||||
/** A data flow sink for sql operation. */
|
||||
private class SqlOperationSink extends ClientSuppliedIpUsedInSecurityCheckSink {
|
||||
SqlOperationSink() { this instanceof QueryInjectionSink }
|
||||
private class SqlOperationSink extends ClientSuppliedIpUsedInSecurityCheckSink instanceof QueryInjectionSink {
|
||||
}
|
||||
|
||||
/** A method that split string. */
|
||||
|
||||
@@ -499,11 +499,8 @@ private RefType getAReferencedType(RefType t) {
|
||||
}
|
||||
|
||||
/** A top level type whose file should be stubbed */
|
||||
class GeneratedTopLevel extends TopLevelType {
|
||||
GeneratedTopLevel() {
|
||||
this = this.getSourceDeclaration() and
|
||||
this instanceof GeneratedType
|
||||
}
|
||||
class GeneratedTopLevel extends TopLevelType instanceof GeneratedType {
|
||||
GeneratedTopLevel() { this = this.getSourceDeclaration() }
|
||||
|
||||
private TopLevelType getAnImportedType() {
|
||||
result = getAReferencedType(this).getSourceDeclaration()
|
||||
@@ -536,8 +533,6 @@ class GeneratedTopLevel extends TopLevelType {
|
||||
|
||||
/** Creates a full stub for the file containing this type. */
|
||||
string stubFile() {
|
||||
result =
|
||||
this.stubComment() + this.stubPackage() + this.stubImports() + this.(GeneratedType).getStub() +
|
||||
"\n"
|
||||
result = this.stubComment() + this.stubPackage() + this.stubImports() + super.getStub() + "\n"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user