Merge pull request #766 from remobjects/resx-delete-on-clean
[mono.git] / mcs / mcs / assign.cs
index e91479ffd92e88d12e05a96fcceb370a8703d686..49595edd0f473212d53faef69c0af454ae60bfbf 100644 (file)
@@ -310,6 +310,12 @@ namespace Mono.CSharp {
                        }
                }
 
+               public override Location StartLocation {
+                       get {
+                               return target.StartLocation;
+                       }
+               }
+
                public override bool ContainsEmitWithAwait ()
                {
                        return target.ContainsEmitWithAwait () || source.ContainsEmitWithAwait ();
@@ -536,7 +542,7 @@ namespace Mono.CSharp {
                // Keep resolved value because field initializers have their own rules
                //
                ExpressionStatement resolved;
-               IMemberContext mc;
+               FieldBase mc;
 
                public FieldInitializer (FieldBase mc, Expression expression, Location loc)
                        : base (new FieldExpr (mc.Spec, expression.Location), expression, loc)
@@ -546,6 +552,12 @@ namespace Mono.CSharp {
                                ((FieldExpr)target).InstanceExpression = new CompilerGeneratedThis (mc.CurrentType, expression.Location);
                }
 
+               public override Location StartLocation {
+                       get {
+                               return loc;
+                       }
+               }
+
                protected override Expression DoResolve (ResolveContext ec)
                {
                        // Field initializer can be resolved (fail) many times
@@ -720,7 +732,7 @@ namespace Mono.CSharp {
                        if (left == null)
                                left = new TargetExpression (target);
 
-                       source = new Binary (op, left, right, true, loc);
+                       source = new Binary (op, left, right, true);
 
                        if (target is DynamicMemberAssignable) {
                                Arguments targs = ((DynamicMemberAssignable) target).Arguments;
@@ -792,8 +804,19 @@ namespace Mono.CSharp {
                        // Otherwise, if the selected operator is a predefined operator
                        //
                        Binary b = source as Binary;
-                       if (b == null && source is ReducedExpression)
-                               b = ((ReducedExpression) source).OriginalExpression as Binary;
+                       if (b == null) {
+                               if (source is ReducedExpression)
+                                       b = ((ReducedExpression) source).OriginalExpression as Binary;
+                               else if (source is ReducedExpression.ReducedConstantExpression) {
+                                       b = ((ReducedExpression.ReducedConstantExpression) source).OriginalExpression as Binary;
+                               } else if (source is Nullable.LiftedBinaryOperator) {
+                                       var po = ((Nullable.LiftedBinaryOperator) source);
+                                       if (po.UserOperator == null)
+                                               b = po.Binary;
+                               } else if (source is TypeCast) {
+                                       b = ((TypeCast) source).Child as Binary;
+                               }
+                       }
 
                        if (b != null) {
                                //