@@ -6,29 +6,36 @@ private import unified
66private import codeql.unified.internal.NameBindingPlugin
77
88module Public {
9+ /** An assignment, possibly a compound assignment. */
10+ abstract class AssignmentImpl extends BinaryExpr {
11+ /** Gets the target of this assignment. */
12+ abstract Expr getTarget ( ) ;
13+
14+ /** Gets the value assigned by this assignment. */
15+ abstract Expr getValue ( ) ;
16+ }
17+
18+ final class Assignment = AssignmentImpl ;
19+
920 /** A plain assignment expression. */
10- class AssignExpr extends BinaryExpr {
21+ final class AssignExpr extends BinaryExpr , AssignmentImpl {
1122 AssignExpr ( ) { this .getOperator ( ) .getValue ( ) = "=" }
1223
13- /** Gets the target of this assignment. */
14- Expr getTarget ( ) { result = this .getLeft ( ) }
24+ override Expr getTarget ( ) { result = this .getLeft ( ) }
1525
16- /** Gets the value assigned by this assignment. */
17- Expr getValue ( ) { result = this .getRight ( ) }
26+ override Expr getValue ( ) { result = this .getRight ( ) }
1827 }
1928
2029 /** A compound assignment expression. */
21- class CompoundAssignExpr extends BinaryExpr {
30+ final class CompoundAssignExpr extends BinaryExpr , AssignmentImpl {
2231 CompoundAssignExpr ( ) {
2332 this .getOperator ( ) .getValue ( ) =
2433 [ "+=" , "-=" , "*=" , "/=" , "%=" , "<<=" , ">>=" , "&=" , "|=" , "^=" , "&+=" , "&-=" , "&*=" ]
2534 }
2635
27- /** Gets the target of this assignment. */
28- Expr getTarget ( ) { result = this .getLeft ( ) }
36+ override Expr getTarget ( ) { result = this .getLeft ( ) }
2937
30- /** Gets the value assigned by this assignment. */
31- Expr getValue ( ) { result = this .getRight ( ) }
38+ override Expr getValue ( ) { result = this .getRight ( ) }
3239 }
3340
3441 /** A short-circuiting logical AND expression. */
0 commit comments