mirror of
https://github.com/github/codeql.git
synced 2026-03-31 12:48:17 +02:00
C#: Use the DB types and replace the abstract class implementation.
This commit is contained in:
@@ -107,7 +107,7 @@ class BinaryArithmeticOperation extends ArithmeticOperation, BinaryOperation, @b
|
||||
/**
|
||||
* An addition operation, for example `x + y`.
|
||||
*/
|
||||
class AddExpr extends BinaryArithmeticOperation, @add_expr {
|
||||
class AddExpr extends BinaryArithmeticOperation, AddOperation, @add_expr {
|
||||
override string getOperator() { result = "+" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "AddExpr" }
|
||||
@@ -116,7 +116,7 @@ class AddExpr extends BinaryArithmeticOperation, @add_expr {
|
||||
/**
|
||||
* A subtraction operation, for example `x - y`.
|
||||
*/
|
||||
class SubExpr extends BinaryArithmeticOperation, @sub_expr {
|
||||
class SubExpr extends BinaryArithmeticOperation, SubOperation, @sub_expr {
|
||||
override string getOperator() { result = "-" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "SubExpr" }
|
||||
@@ -125,7 +125,7 @@ class SubExpr extends BinaryArithmeticOperation, @sub_expr {
|
||||
/**
|
||||
* A multiplication operation, for example `x * y`.
|
||||
*/
|
||||
class MulExpr extends BinaryArithmeticOperation, @mul_expr {
|
||||
class MulExpr extends BinaryArithmeticOperation, MulOperation, @mul_expr {
|
||||
override string getOperator() { result = "*" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "MulExpr" }
|
||||
@@ -134,22 +134,16 @@ class MulExpr extends BinaryArithmeticOperation, @mul_expr {
|
||||
/**
|
||||
* A division operation, for example `x / y`.
|
||||
*/
|
||||
class DivExpr extends BinaryArithmeticOperation, @div_expr {
|
||||
class DivExpr extends BinaryArithmeticOperation, DivOperation, @div_expr {
|
||||
override string getOperator() { result = "/" }
|
||||
|
||||
/** Gets the numerator of this division operation. */
|
||||
Expr getNumerator() { result = this.getLeftOperand() }
|
||||
|
||||
/** Gets the denominator of this division operation. */
|
||||
Expr getDenominator() { result = this.getRightOperand() }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "DivExpr" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A remainder operation, for example `x % y`.
|
||||
*/
|
||||
class RemExpr extends BinaryArithmeticOperation, @rem_expr {
|
||||
class RemExpr extends BinaryArithmeticOperation, RemOperation, @rem_expr {
|
||||
override string getOperator() { result = "%" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "RemExpr" }
|
||||
|
||||
@@ -99,7 +99,7 @@ class AssignArithmeticOperation extends AssignCallOperation, @assign_arith_expr
|
||||
/**
|
||||
* An addition assignment operation, for example `x += y`.
|
||||
*/
|
||||
class AssignAddExpr extends AssignArithmeticOperation, @assign_add_expr {
|
||||
class AssignAddExpr extends AssignArithmeticOperation, AddOperation, @assign_add_expr {
|
||||
override string getOperator() { result = "+=" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "AssignAddExpr" }
|
||||
@@ -108,7 +108,7 @@ class AssignAddExpr extends AssignArithmeticOperation, @assign_add_expr {
|
||||
/**
|
||||
* A subtraction assignment operation, for example `x -= y`.
|
||||
*/
|
||||
class AssignSubExpr extends AssignArithmeticOperation, @assign_sub_expr {
|
||||
class AssignSubExpr extends AssignArithmeticOperation, SubOperation, @assign_sub_expr {
|
||||
override string getOperator() { result = "-=" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "AssignSubExpr" }
|
||||
@@ -117,7 +117,7 @@ class AssignSubExpr extends AssignArithmeticOperation, @assign_sub_expr {
|
||||
/**
|
||||
* An multiplication assignment operation, for example `x *= y`.
|
||||
*/
|
||||
class AssignMulExpr extends AssignArithmeticOperation, @assign_mul_expr {
|
||||
class AssignMulExpr extends AssignArithmeticOperation, MulOperation, @assign_mul_expr {
|
||||
override string getOperator() { result = "*=" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "AssignMulExpr" }
|
||||
@@ -126,7 +126,7 @@ class AssignMulExpr extends AssignArithmeticOperation, @assign_mul_expr {
|
||||
/**
|
||||
* An division assignment operation, for example `x /= y`.
|
||||
*/
|
||||
class AssignDivExpr extends AssignArithmeticOperation, @assign_div_expr {
|
||||
class AssignDivExpr extends AssignArithmeticOperation, DivOperation, @assign_div_expr {
|
||||
override string getOperator() { result = "/=" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "AssignDivExpr" }
|
||||
@@ -135,7 +135,7 @@ class AssignDivExpr extends AssignArithmeticOperation, @assign_div_expr {
|
||||
/**
|
||||
* A remainder assignment operation, for example `x %= y`.
|
||||
*/
|
||||
class AssignRemExpr extends AssignArithmeticOperation, @assign_rem_expr {
|
||||
class AssignRemExpr extends AssignArithmeticOperation, RemOperation, @assign_rem_expr {
|
||||
override string getOperator() { result = "%=" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "AssignRemExpr" }
|
||||
@@ -155,7 +155,7 @@ class AssignBitwiseOperation extends AssignCallOperation, @assign_bitwise_expr {
|
||||
/**
|
||||
* A bitwise-and assignment operation, for example `x &= y`.
|
||||
*/
|
||||
class AssignAndExpr extends AssignBitwiseOperation, @assign_and_expr {
|
||||
class AssignAndExpr extends AssignBitwiseOperation, BitwiseAndOperation, @assign_and_expr {
|
||||
override string getOperator() { result = "&=" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "AssignAndExpr" }
|
||||
@@ -164,7 +164,7 @@ class AssignAndExpr extends AssignBitwiseOperation, @assign_and_expr {
|
||||
/**
|
||||
* A bitwise-or assignment operation, for example `x |= y`.
|
||||
*/
|
||||
class AssignOrExpr extends AssignBitwiseOperation, @assign_or_expr {
|
||||
class AssignOrExpr extends AssignBitwiseOperation, BitwiseOrOperation, @assign_or_expr {
|
||||
override string getOperator() { result = "|=" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "AssignOrExpr" }
|
||||
@@ -173,7 +173,7 @@ class AssignOrExpr extends AssignBitwiseOperation, @assign_or_expr {
|
||||
/**
|
||||
* A bitwise exclusive-or assignment operation, for example `x ^= y`.
|
||||
*/
|
||||
class AssignXorExpr extends AssignBitwiseOperation, @assign_xor_expr {
|
||||
class AssignXorExpr extends AssignBitwiseOperation, BitwiseXorOperation, @assign_xor_expr {
|
||||
override string getOperator() { result = "^=" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "AssignXorExpr" }
|
||||
@@ -182,7 +182,7 @@ class AssignXorExpr extends AssignBitwiseOperation, @assign_xor_expr {
|
||||
/**
|
||||
* A left-shift assignment operation, for example `x <<= y`.
|
||||
*/
|
||||
class AssignLeftShiftExpr extends AssignBitwiseOperation, @assign_lshift_expr {
|
||||
class AssignLeftShiftExpr extends AssignBitwiseOperation, LeftShiftOperation, @assign_lshift_expr {
|
||||
override string getOperator() { result = "<<=" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "AssignLeftShiftExpr" }
|
||||
@@ -191,7 +191,7 @@ class AssignLeftShiftExpr extends AssignBitwiseOperation, @assign_lshift_expr {
|
||||
/**
|
||||
* A right-shift assignment operation, for example `x >>= y`.
|
||||
*/
|
||||
class AssignRightShiftExpr extends AssignBitwiseOperation, @assign_rshift_expr {
|
||||
class AssignRightShiftExpr extends AssignBitwiseOperation, RightShiftOperation, @assign_rshift_expr {
|
||||
override string getOperator() { result = ">>=" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "AssignRightShiftExpr" }
|
||||
@@ -200,7 +200,9 @@ class AssignRightShiftExpr extends AssignBitwiseOperation, @assign_rshift_expr {
|
||||
/**
|
||||
* An unsigned right-shift assignment operation, for example `x >>>= y`.
|
||||
*/
|
||||
class AssignUnsignedRightShiftExpr extends AssignBitwiseOperation, @assign_urshift_expr {
|
||||
class AssignUnsignedRightShiftExpr extends AssignBitwiseOperation, UnsignedRightShiftOperation,
|
||||
@assign_urshift_expr
|
||||
{
|
||||
override string getOperator() { result = ">>>=" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "AssignUnsignedRightShiftExpr" }
|
||||
@@ -273,7 +275,7 @@ class RemoveEventExpr extends AddOrRemoveEventExpr, @remove_event_expr {
|
||||
/**
|
||||
* A null-coalescing assignment operation, for example `x ??= y`.
|
||||
*/
|
||||
class AssignCoalesceExpr extends AssignOperation, @assign_coalesce_expr {
|
||||
class AssignCoalesceExpr extends AssignOperation, NullCoalescingOperation, @assign_coalesce_expr {
|
||||
override string toString() { result = "... ??= ..." }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "AssignCoalesceExpr" }
|
||||
|
||||
@@ -41,7 +41,7 @@ class BinaryBitwiseOperation extends BitwiseOperation, BinaryOperation, @bin_bit
|
||||
/**
|
||||
* A left-shift operation, for example `x << y`.
|
||||
*/
|
||||
class LeftShiftExpr extends BinaryBitwiseOperation, @lshift_expr {
|
||||
class LeftShiftExpr extends BinaryBitwiseOperation, LeftShiftOperation, @lshift_expr {
|
||||
override string getOperator() { result = "<<" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "LeftShiftExpr" }
|
||||
@@ -50,7 +50,7 @@ class LeftShiftExpr extends BinaryBitwiseOperation, @lshift_expr {
|
||||
/**
|
||||
* A right-shift operation, for example `x >> y`.
|
||||
*/
|
||||
class RightShiftExpr extends BinaryBitwiseOperation, @rshift_expr {
|
||||
class RightShiftExpr extends BinaryBitwiseOperation, RightShiftOperation, @rshift_expr {
|
||||
override string getOperator() { result = ">>" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "RightShiftExpr" }
|
||||
@@ -59,7 +59,9 @@ class RightShiftExpr extends BinaryBitwiseOperation, @rshift_expr {
|
||||
/**
|
||||
* An unsigned right-shift operation, for example `x >>> y`.
|
||||
*/
|
||||
class UnsignedRightShiftExpr extends BinaryBitwiseOperation, @urshift_expr {
|
||||
class UnsignedRightShiftExpr extends BinaryBitwiseOperation, UnsignedRightShiftOperation,
|
||||
@urshift_expr
|
||||
{
|
||||
override string getOperator() { result = ">>>" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "UnsignedRightShiftExpr" }
|
||||
@@ -68,7 +70,7 @@ class UnsignedRightShiftExpr extends BinaryBitwiseOperation, @urshift_expr {
|
||||
/**
|
||||
* A bitwise-and operation, for example `x & y`.
|
||||
*/
|
||||
class BitwiseAndExpr extends BinaryBitwiseOperation, @bit_and_expr {
|
||||
class BitwiseAndExpr extends BinaryBitwiseOperation, BitwiseAndOperation, @bit_and_expr {
|
||||
override string getOperator() { result = "&" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BitwiseAndExpr" }
|
||||
@@ -77,7 +79,7 @@ class BitwiseAndExpr extends BinaryBitwiseOperation, @bit_and_expr {
|
||||
/**
|
||||
* A bitwise-or operation, for example `x | y`.
|
||||
*/
|
||||
class BitwiseOrExpr extends BinaryBitwiseOperation, @bit_or_expr {
|
||||
class BitwiseOrExpr extends BinaryBitwiseOperation, BitwiseOrOperation, @bit_or_expr {
|
||||
override string getOperator() { result = "|" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BitwiseOrExpr" }
|
||||
@@ -86,7 +88,7 @@ class BitwiseOrExpr extends BinaryBitwiseOperation, @bit_or_expr {
|
||||
/**
|
||||
* A bitwise exclusive-or operation, for example `x ^ y`.
|
||||
*/
|
||||
class BitwiseXorExpr extends BinaryBitwiseOperation, @bit_xor_expr {
|
||||
class BitwiseXorExpr extends BinaryBitwiseOperation, BitwiseXorOperation, @bit_xor_expr {
|
||||
override string getOperator() { result = "^" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BitwiseXorExpr" }
|
||||
|
||||
@@ -65,7 +65,9 @@ class LogicalOrExpr extends BinaryLogicalOperation, @log_or_expr {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class NullCoalescingExpr extends BinaryLogicalOperation, @null_coalescing_expr {
|
||||
class NullCoalescingExpr extends BinaryLogicalOperation, NullCoalescingOperation,
|
||||
@null_coalescing_expr
|
||||
{
|
||||
override string getOperator() { result = "??" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "NullCoalescingExpr" }
|
||||
|
||||
@@ -4,119 +4,68 @@
|
||||
|
||||
import Expr
|
||||
|
||||
/** A binary operation that involves a null-coalescing operation. */
|
||||
abstract private class NullCoalescingOperationImpl extends BinaryOperation { }
|
||||
/**
|
||||
* An addition operation, either `x + y` or `x += y`.
|
||||
*/
|
||||
class AddOperation extends BinaryOperation, @add_operation { }
|
||||
|
||||
final class NullCoalescingOperation = NullCoalescingOperationImpl;
|
||||
/**
|
||||
* A subtraction operation, either `x - y` or `x -= y`.
|
||||
*/
|
||||
class SubOperation extends BinaryOperation, @sub_operation { }
|
||||
|
||||
private class AddNullCoalescingExpr extends NullCoalescingOperationImpl instanceof NullCoalescingExpr
|
||||
{ }
|
||||
/**
|
||||
* A multiplication operation, either `x * y` or `x *= y`.
|
||||
*/
|
||||
class MulOperation extends BinaryOperation, @mul_operation { }
|
||||
|
||||
private class AddAssignCoalesceExpr extends NullCoalescingOperationImpl instanceof AssignCoalesceExpr
|
||||
{ }
|
||||
/**
|
||||
* A division operation, either `x / y` or `x /= y`.
|
||||
*/
|
||||
class DivOperation extends BinaryOperation, @div_operation {
|
||||
/** Gets the numerator of this division operation. */
|
||||
Expr getNumerator() { result = this.getLeftOperand() }
|
||||
|
||||
/** A binary operations that involves an addition operation. */
|
||||
abstract private class AddOperationImpl extends BinaryOperation { }
|
||||
|
||||
final class AddOperation = AddOperationImpl;
|
||||
|
||||
private class AddAddExpr extends AddOperationImpl instanceof AddExpr { }
|
||||
|
||||
private class AddAssignExpr extends AddOperationImpl instanceof AssignAddExpr { }
|
||||
|
||||
/** A binary operation that involves a subtraction operation. */
|
||||
abstract private class SubOperationImpl extends BinaryOperation { }
|
||||
|
||||
final class SubOperation = SubOperationImpl;
|
||||
|
||||
private class AddSubExpr extends SubOperationImpl instanceof SubExpr { }
|
||||
|
||||
private class AddSubAssignExpr extends SubOperationImpl instanceof AssignSubExpr { }
|
||||
|
||||
/** A binary operation that involves a multiplication operation. */
|
||||
abstract private class MulOperationImpl extends BinaryOperation { }
|
||||
|
||||
final class MulOperation = MulOperationImpl;
|
||||
|
||||
private class AddMulExpr extends MulOperationImpl instanceof MulExpr { }
|
||||
|
||||
private class AddMulAssignExpr extends MulOperationImpl instanceof AssignMulExpr { }
|
||||
|
||||
/** A binary operation that involves a division operation. */
|
||||
abstract private class DivOperationImpl extends BinaryOperation {
|
||||
/** Gets the denominator of this division operation. */
|
||||
Expr getDenominator() { result = this.getRightOperand() }
|
||||
}
|
||||
|
||||
final class DivOperation = DivOperationImpl;
|
||||
/**
|
||||
* A remainder operation, either `x % y` or `x %= y`.
|
||||
*/
|
||||
class RemOperation extends BinaryOperation, @rem_operation { }
|
||||
|
||||
private class AddDivExpr extends DivOperationImpl instanceof DivExpr { }
|
||||
/**
|
||||
* A bitwise-and operation, either `x & y` or `x &= y`.
|
||||
*/
|
||||
class BitwiseAndOperation extends BinaryOperation, @and_operation { }
|
||||
|
||||
private class AddDivAssignExpr extends DivOperationImpl instanceof AssignDivExpr { }
|
||||
/**
|
||||
* A bitwise-or operation, either `x | y` or `x |= y`.
|
||||
*/
|
||||
class BitwiseOrOperation extends BinaryOperation, @or_operation { }
|
||||
|
||||
/** A binary operation that involves a remainder operation. */
|
||||
abstract private class RemOperationImpl extends BinaryOperation { }
|
||||
/**
|
||||
* A bitwise exclusive-or operation, either `x ^ y` or `x ^= y`.
|
||||
*/
|
||||
class BitwiseXorOperation extends BinaryOperation, @xor_operation { }
|
||||
|
||||
final class RemOperation = RemOperationImpl;
|
||||
/**
|
||||
* A left-shift operation, either `x << y` or `x <<= y`.
|
||||
*/
|
||||
class LeftShiftOperation extends BinaryOperation, @lshift_operation { }
|
||||
|
||||
private class AddRemExpr extends RemOperationImpl instanceof RemExpr { }
|
||||
/**
|
||||
* A right-shift operation, either `x >> y` or `x >>= y`.
|
||||
*/
|
||||
class RightShiftOperation extends BinaryOperation, @rshift_operation { }
|
||||
|
||||
private class AddRemAssignExpr extends RemOperationImpl instanceof AssignRemExpr { }
|
||||
/**
|
||||
* An unsigned right-shift operation, either `x >>> y` or `x >>>= y`.
|
||||
*/
|
||||
class UnsignedRightShiftOperation extends BinaryOperation, @urshift_operation { }
|
||||
|
||||
/** A binary operation that involves a bitwise AND operation. */
|
||||
abstract private class BitwiseAndOperationImpl extends BinaryOperation { }
|
||||
|
||||
final class BitwiseAndOperation = BitwiseAndOperationImpl;
|
||||
|
||||
private class AddBitwiseAndExpr extends BitwiseAndOperationImpl instanceof BitwiseAndExpr { }
|
||||
|
||||
private class AddAssignBitwiseAndExpr extends BitwiseAndOperationImpl instanceof AssignAndExpr { }
|
||||
|
||||
/** A binary operation that involves a bitwise OR operation. */
|
||||
abstract private class BitwiseOrOperationImpl extends BinaryOperation { }
|
||||
|
||||
final class BitwiseOrOperation = BitwiseOrOperationImpl;
|
||||
|
||||
private class AddBitwiseOrExpr extends BitwiseOrOperationImpl instanceof BitwiseOrExpr { }
|
||||
|
||||
private class AddAssignBitwiseOrExpr extends BitwiseOrOperationImpl instanceof AssignOrExpr { }
|
||||
|
||||
/** A binary operation that involves a bitwise XOR operation. */
|
||||
abstract private class BitwiseXorOperationImpl extends BinaryOperation { }
|
||||
|
||||
final class BitwiseXorOperation = BitwiseXorOperationImpl;
|
||||
|
||||
private class AddBitwiseXorExpr extends BitwiseXorOperationImpl instanceof BitwiseXorExpr { }
|
||||
|
||||
private class AddAssignBitwiseXorExpr extends BitwiseXorOperationImpl instanceof AssignXorExpr { }
|
||||
|
||||
/** A binary operation that involves a left shift operation. */
|
||||
abstract private class LeftShiftOperationImpl extends BinaryOperation { }
|
||||
|
||||
final class LeftShiftOperation = LeftShiftOperationImpl;
|
||||
|
||||
private class AddLeftShiftExpr extends LeftShiftOperationImpl instanceof LeftShiftExpr { }
|
||||
|
||||
private class AddAssignLeftShiftExpr extends LeftShiftOperationImpl instanceof AssignLeftShiftExpr {
|
||||
}
|
||||
|
||||
/** A binary operation that involves a right shift operation. */
|
||||
abstract private class RightShiftOperationImpl extends BinaryOperation { }
|
||||
|
||||
final class RightShiftOperation = RightShiftOperationImpl;
|
||||
|
||||
private class AddRightShiftExpr extends RightShiftOperationImpl instanceof RightShiftExpr { }
|
||||
|
||||
private class AddAssignRightShiftExpr extends RightShiftOperationImpl instanceof AssignRightShiftExpr
|
||||
{ }
|
||||
|
||||
/** A binary operation that involves a unsigned right shift operation. */
|
||||
abstract private class UnsignedRightShiftOperationImpl extends BinaryOperation { }
|
||||
|
||||
final class UnsignedRightShiftOperation = UnsignedRightShiftOperationImpl;
|
||||
|
||||
private class AddUnsignedRightShiftExpr extends UnsignedRightShiftOperationImpl instanceof UnsignedRightShiftExpr
|
||||
{ }
|
||||
|
||||
private class AddAssignUnsignedRightShiftExpr extends UnsignedRightShiftOperationImpl instanceof AssignUnsignedRightShiftExpr
|
||||
{ }
|
||||
/**
|
||||
* A null-coalescing operation, either `x ?? y` or `x ??= y`.
|
||||
*/
|
||||
class NullCoalescingOperation extends BinaryOperation, @null_coalescing_operation { }
|
||||
|
||||
Reference in New Issue
Block a user