Rust: Add missing assignment class relations.

This commit is contained in:
Geoffrey White
2025-05-22 15:18:45 +01:00
parent b22ce5515f
commit dc280c6fb7
2 changed files with 9 additions and 11 deletions

View File

@@ -5,6 +5,7 @@
private import codeql.rust.elements.BinaryExpr
private import codeql.rust.elements.PrefixExpr
private import codeql.rust.elements.Operation
private import codeql.rust.elements.AssignmentOperation
/**
* An arithmetic operation, such as `+`, `*=`, or `-`.
@@ -17,25 +18,21 @@ final class ArithmeticOperation = ArithmeticOperationImpl;
* A binary arithmetic operation, such as `+` or `*`.
*/
final class BinaryArithmeticOperation extends BinaryExpr, ArithmeticOperationImpl {
BinaryArithmeticOperation() {
this.getOperatorName() = ["+", "-", "*", "/", "%"]
}
BinaryArithmeticOperation() { this.getOperatorName() = ["+", "-", "*", "/", "%"] }
}
/**
* An arithmetic assignment operation, such as `+=` or `*=`.
*/
final class AssignArithmeticOperation extends BinaryExpr, ArithmeticOperationImpl {
AssignArithmeticOperation() {
this.getOperatorName() = ["+=", "-=", "*=", "/=", "%="]
}
final class AssignArithmeticOperation extends BinaryExpr, ArithmeticOperationImpl,
AssignmentOperation
{
AssignArithmeticOperation() { this.getOperatorName() = ["+=", "-=", "*=", "/=", "%="] }
}
/**
* A prefix arithmetic operation, such as `-`.
*/
final class PrefixArithmeticOperation extends PrefixExpr, ArithmeticOperationImpl {
PrefixArithmeticOperation() {
this.getOperatorName() = "-"
}
PrefixArithmeticOperation() { this.getOperatorName() = "-" }
}

View File

@@ -4,6 +4,7 @@
private import codeql.rust.elements.BinaryExpr
private import codeql.rust.elements.Operation
private import codeql.rust.elements.AssignmentOperation
/**
* A bitwise operation, such as `&`, `<<`, or `|=`.
@@ -22,6 +23,6 @@ final class BinaryBitwiseOperation extends BinaryExpr, BitwiseOperationImpl {
/**
* A bitwise assignment operation, such as `|=` or `<<=`.
*/
final class AssignBitwiseOperation extends BinaryExpr, BitwiseOperationImpl {
final class AssignBitwiseOperation extends BinaryExpr, BitwiseOperationImpl, AssignmentOperation {
AssignBitwiseOperation() { this.getOperatorName() = ["&=", "|=", "^=", "<<=", ">>="] }
}