@@ -17,18 +17,14 @@ class Assignment extends BinaryOperation, @assign_expr {
1717 implies
1818 // Same as `this.(LocalVariableDeclExpr).hasInitializer()` but avoids
1919 // negative recursion
20- expr_parent ( _, 0 , this )
20+ expr_parent ( _, 1 , this )
2121 }
2222
23- override Expr getLeftOperand ( ) { result = this .getChild ( 1 ) }
24-
25- override Expr getRightOperand ( ) { result = this .getChild ( 0 ) }
26-
2723 /** Gets the left operand of this assignment. */
28- Expr getLValue ( ) { result = this .getChild ( 1 ) }
24+ Expr getLValue ( ) { result = this .getLeftOperand ( ) }
2925
3026 /** Gets the right operand of this assignment. */
31- Expr getRValue ( ) { result = this .getChild ( 0 ) }
27+ Expr getRValue ( ) { result = this .getRightOperand ( ) }
3228
3329 /** Gets the variable being assigned to, if any. */
3430 Variable getTargetVariable ( ) { result .getAnAccess ( ) = this .getLValue ( ) }
@@ -64,34 +60,30 @@ class AssignExpr extends Assignment, @simple_assign_expr {
6460
6561/**
6662 * An assignment operation. Either an arithmetic assignment operation
67- * (`AssignArithmeticOperation`), a bitwise assignment operation
68- * (`AssignBitwiseOperation`), or an event assignment (`AddOrRemoveEventExpr`).
63+ * (`AssignArithmeticOperation`), a bitwise assignment operation or
64+ * (`AssignBitwiseOperation`), an event assignment (`AddOrRemoveEventExpr`), or
65+ * a null-coalescing assignment (`AssignCoalesceExpr`).
6966 */
7067class AssignOperation extends Assignment , @assign_op_expr {
7168 override string getOperator ( ) { none ( ) }
7269
7370 /**
74- * Gets the expanded version of this assignment operation, if any.
75- *
76- * For example, if this assignment operation is `x += y` then
77- * the expanded assignment is `x = x + y`.
78- *
79- * If an expanded version exists, then it is used in the control
80- * flow graph.
71+ * Expanded versions of compound assignments are no longer extracted.
8172 */
82- AssignExpr getExpandedAssignment ( ) { expr_parent ( result , 2 , this ) }
73+ deprecated AssignExpr getExpandedAssignment ( ) { none ( ) }
8374
8475 /**
85- * Holds if this assignment operation has an expanded version.
86- *
87- * For example, if this assignment operation is `x += y` then
88- * it has the expanded version `x = x + y`.
89- *
90- * If an expanded version exists, then it is used in the control
91- * flow graph.
76+ * Expanded versions of compound assignments are no longer extracted.
9277 */
93- predicate hasExpandedAssignment ( ) { exists ( this .getExpandedAssignment ( ) ) }
78+ deprecated predicate hasExpandedAssignment ( ) { none ( ) }
79+
80+ override string toString ( ) { result = "... " + this .getOperator ( ) + " ..." }
81+ }
9482
83+ /**
84+ * An assignment operation that corresponds to an operator call, for example `x += y` corresponds to `x = x + y`.
85+ */
86+ class AssignCallOperation extends AssignOperation , OperatorCall , @assign_op_call_expr {
9587 override string toString ( ) { result = "... " + this .getOperator ( ) + " ..." }
9688}
9789
@@ -102,7 +94,7 @@ class AssignOperation extends Assignment, @assign_op_expr {
10294 * operation (`AssignDivExpr`), or a remainder assignment operation
10395 * (`AssignRemExpr`).
10496 */
105- class AssignArithmeticOperation extends AssignOperation , @assign_arith_expr { }
97+ class AssignArithmeticOperation extends AssignCallOperation , @assign_arith_expr { }
10698
10799/**
108100 * An addition assignment operation, for example `x += y`.
@@ -158,7 +150,7 @@ class AssignRemExpr extends AssignArithmeticOperation, @assign_rem_expr {
158150 * operation (`AssignRightShiftExpr`), or an unsigned right-shift assignment
159151 * operation (`AssignUnsignedRightShiftExpr`).
160152 */
161- class AssignBitwiseOperation extends AssignOperation , @assign_bitwise_expr { }
153+ class AssignBitwiseOperation extends AssignCallOperation , @assign_bitwise_expr { }
162154
163155/**
164156 * A bitwise-and assignment operation, for example `x &= y`.
@@ -208,12 +200,17 @@ class AssignRightShiftExpr extends AssignBitwiseOperation, @assign_rshift_expr {
208200/**
209201 * An unsigned right-shift assignment operation, for example `x >>>= y`.
210202 */
211- class AssignUnsighedRightShiftExpr extends AssignBitwiseOperation , @assign_urshift_expr {
203+ class AssignUnsignedRightShiftExpr extends AssignBitwiseOperation , @assign_urshift_expr {
212204 override string getOperator ( ) { result = ">>>=" }
213205
214- override string getAPrimaryQlClass ( ) { result = "AssignUnsighedRightShiftExpr " }
206+ override string getAPrimaryQlClass ( ) { result = "AssignUnsignedRightShiftExpr " }
215207}
216208
209+ /**
210+ * DEPRECATED: Use `AssignUnsignedRightShiftExpr` instead.
211+ */
212+ deprecated class AssignUnsighedRightShiftExpr = AssignUnsignedRightShiftExpr ;
213+
217214/**
218215 * An event assignment. Either an event addition (`AddEventExpr`) or an event
219216 * removal (`RemoveEventExpr`).
@@ -222,9 +219,9 @@ class AddOrRemoveEventExpr extends AssignOperation, @assign_event_expr {
222219 /** Gets the event targeted by this event assignment. */
223220 Event getTarget ( ) { result = this .getLValue ( ) .getTarget ( ) }
224221
225- override EventAccess getLValue ( ) { result = this .getChild ( 1 ) }
222+ override EventAccess getLValue ( ) { result = this .getChild ( 0 ) }
226223
227- override Expr getRValue ( ) { result = this .getChild ( 0 ) }
224+ override EventAccess getLeftOperand ( ) { result = this .getChild ( 0 ) }
228225}
229226
230227/**
0 commit comments