Skip to content

Commit 04666e0

Browse files
committed
unified: Manually add corresponding classes
1 parent b0e7313 commit 04666e0

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

‎unified/ql/lib/codeql/unified/internal/AstExtra.qll‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,31 @@ private import unified
66
private import codeql.unified.internal.NameBindingPlugin
77

88
module Public {
9+
/** A plain assignment expression. */
10+
class AssignExpr extends BinaryExpr {
11+
AssignExpr() { this.getOperator().getValue() = "=" }
12+
13+
/** Gets the target of this assignment. */
14+
Expr getTarget() { result = this.getLeft() }
15+
16+
/** Gets the value assigned by this assignment. */
17+
Expr getValue() { result = this.getRight() }
18+
}
19+
20+
/** A compound assignment expression. */
21+
class CompoundAssignExpr extends BinaryExpr {
22+
CompoundAssignExpr() {
23+
this.getOperator().getValue() =
24+
["+=", "-=", "*=", "/=", "%=", "<<=", ">>=", "&=", "|=", "^=", "&+=", "&-=", "&*="]
25+
}
26+
27+
/** Gets the target of this assignment. */
28+
Expr getTarget() { result = this.getLeft() }
29+
30+
/** Gets the value assigned by this assignment. */
31+
Expr getValue() { result = this.getRight() }
32+
}
33+
934
/** A short-circuiting logical AND expression. */
1035
class LogicalAndExpr extends BinaryExpr {
1136
LogicalAndExpr() { this.getOperator().getValue() = "&&" }

0 commit comments

Comments
 (0)