Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 352024

Summary: Resolution of compound assignment operators
Product: z_Archived Reporter: Matt Heitz <mheitz>
Component: EDTAssignee: Justin Spadea <jspadea>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: jspadea, pharmon
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Matt Heitz CLA 2011-07-13 15:48:09 EDT
When resolving the EGL function for compound assignment operators like "+=" and "::=", the compiler should look for a function for the non-assigning form of the operator.  In other words, when resolving the operation function for "x *= 4", look for the "*" function as if the expression were written "x = x * 4".

This means EGL types don't have to define functions for the assigning form of the operators they support.  This implicit definition saves some keystrokes, but more importantly it eliminates the possibility of mistakes.  There's no way to omit a compound assignment operator or accidentally use a different operand type from the non-assigning operator.

The Assignment class should have a getOperation() method which will retrieve the Operation of a compound assignment.
Comment 1 Justin Spadea CLA 2011-07-15 10:44:31 EDT
API for getOperation()/setOperation() has been added to Assignment.java (and AssignmentImpl.java), as well as Expressions.egl.

If the assignment does not use a compound operator, getOperation() returns null.
Comment 2 Matt Heitz CLA 2011-09-08 13:55:39 EDT
Closing.