* @param lvalue - the resolved lvalue (which is also an implicit rvalue).
* @param opcode - the opcode of the implied binary operator.
*/
public void checkCompoundAssignment(IASNode iNode, Binding lvalue, final int opcode)
{
ICompoundAssignmentNode compoundNode = (ICompoundAssignmentNode)iNode;
IBinaryOperatorNode binop = (IBinaryOperatorNode)iNode;
checkLValue(iNode, lvalue);
if ( SemanticUtils.isUnprotectedAssignmentInConditional(iNode) )
addProblem(new AssignmentInConditionalProblem(binop.getLeftOperandNode()));
// Check the implicit binary operator.
checkBinaryOperator(iNode, binop.getLeftOperandNode(), binop.getRightOperandNode(), opcode);
// Check the assignment's types are compatible.
if ( lvalue.getDefinition() != null )
{
// Do own checks, then call common logic to emit diagnostics.
ITypeDefinition lhsType = lvalue.getDefinition().resolveType(this.project);
ITypeDefinition compoundType = compoundNode.resolveTypeOfRValue(this.project);
if ( ! SemanticUtils.isValidImplicitOpAssignment(lhsType, compoundType, opcode, this.project, this.currentScope.getInInvisibleCompilationUnit()) )
{
checkImplicitConversion(binop.getRightOperandNode(), lhsType);
}