File tree Expand file tree Collapse file tree 4 files changed +17
-1
lines changed
test/library-tests/operations Expand file tree Collapse file tree 4 files changed +17
-1
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * Provides classes for deref expressions (`*`).
3
+ */
4
+
5
+ private import codeql.rust.elements.PrefixExpr
6
+ private import codeql.rust.elements.Operation
7
+
8
+ /**
9
+ * A dereference expression, `*`.
10
+ */
11
+ final class DerefExpr extends PrefixExpr , Operation {
12
+ DerefExpr ( ) { this .getOperatorName ( ) = "*" }
13
+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import codeql.rust.elements.ArithmeticOperation
8
8
import codeql.rust.elements.AssignmentOperation
9
9
import codeql.rust.elements.BitwiseOperation
10
10
import codeql.rust.elements.ComparisonOperation
11
+ import codeql.rust.elements.DerefExpr
11
12
import codeql.rust.elements.LiteralExprExt
12
13
import codeql.rust.elements.LogicalOperation
13
14
import codeql.rust.elements.AsyncBlockExpr
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ string describe(Expr op) {
45
45
op instanceof BinaryBitwiseOperation and result = "BinaryBitwiseOperation"
46
46
or
47
47
op instanceof AssignBitwiseOperation and result = "AssignBitwiseOperation"
48
+ or
49
+ op instanceof DerefExpr and result = "DerefExpr"
48
50
}
49
51
50
52
module OperationsTest implements TestSig {
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ fn test_operations(
49
49
x >>= y; // $ Operation Op=>>= Operands=2 AssignmentOperation BinaryExpr BitwiseOperation AssignBitwiseOperation
50
50
51
51
// miscellaneous expressions that might be operations
52
- * ptr; // $ Operation Op=* Operands=1 PrefixExpr
52
+ * ptr; // $ Operation Op=* Operands=1 PrefixExpr DerefExpr
53
53
& x; // $ RefExpr
54
54
res?;
55
55
You can’t perform that action at this time.
0 commit comments