X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fexpression.cs;h=c7747f014fdee5da31e0b772c45dbdaa148c769c;hb=20ab5bfe7ae2cf84cd9e6fdad9758ded9f687ca2;hp=2968ee08584f544f7869efba43e4007b9f259888;hpb=cfeadc51e89f1af952323bb2779066d6813a54ec;p=mono.git diff --git a/mcs/mcs/expression.cs b/mcs/mcs/expression.cs index 2968ee08584..c7747f014fd 100644 --- a/mcs/mcs/expression.cs +++ b/mcs/mcs/expression.cs @@ -3448,7 +3448,7 @@ namespace Mono.CSharp } } - static CSharp.Operator.OpType ConvertBinaryToUserOperator (Operator op) + public static CSharp.Operator.OpType ConvertBinaryToUserOperator (Operator op) { switch (op) { case Operator.Addition: @@ -12174,21 +12174,23 @@ namespace Mono.CSharp args); } - protected override Expression DoResolve (ResolveContext ec) + protected override Expression DoResolve (ResolveContext rc) { - Expression e = base.DoResolve (ec); + Expression e = base.DoResolve (rc); if (type == null) return null; if (type.IsDelegate) { - ec.Report.Error (1958, Initializers.Location, + rc.Report.Error (1958, Initializers.Location, "Object and collection initializers cannot be used to instantiate a delegate"); } - Expression previous = ec.CurrentInitializerVariable; - ec.CurrentInitializerVariable = new InitializerTargetExpression (this); - initializers.Resolve (ec); - ec.CurrentInitializerVariable = previous; + Expression previous = rc.CurrentInitializerVariable; + rc.CurrentInitializerVariable = new InitializerTargetExpression (this); + using (rc.With (ResolveContext.Options.DontSetConditionalAccessReceiver, false)) { + initializers.Resolve (rc); + } + rc.CurrentInitializerVariable = previous; dynamic = e as DynamicExpressionStatement; if (dynamic != null)