+
+ protected override Expression ResolveConversions (EmitContext ec)
+ {
+ Type target_type = target.Type;
+
+ //
+ // 1. the return type is implicitly convertible to the type of target
+ //
+ if (Convert.ImplicitConversionExists (ec, source, target_type)) {
+ source = Convert.ImplicitConversion (ec, source, target_type, loc);
+ return this;
+ }
+
+ //
+ // Otherwise, if the selected operator is a predefined operator
+ //
+ Binary b = source as Binary;
+ if (b != null) {
+ //
+ // 2a. the operator is a shift operator
+ //
+ // 2b. the return type is explicitly convertible to the type of x, and
+ // y is implicitly convertible to the type of x
+ //
+ if ((b.Oper & Binary.Operator.ShiftMask) != 0 ||
+ Convert.ImplicitConversionExists (ec, original_source, target_type)) {
+ source = Convert.ExplicitConversion (ec, source, target_type, loc);
+ return this;
+ }
+ }
+
+ original_source.Error_ValueCannotBeConverted (ec, loc, target_type, false);
+ return null;
+ }
+
+ protected override void CloneTo (CloneContext clonectx, Expression t)
+ {
+ CompoundAssign ctarget = (CompoundAssign) t;
+
+ ctarget.original_source = ctarget.source = source.Clone (clonectx);
+ ctarget.target = target.Clone (clonectx);
+ }