[fix] #631810: Form.DialogResult needs to call its close events *before* closing.
[mono.git] / mcs / mcs / lambda.cs
index eb4907b1816bd663a7df3120411ff50119a3f3ca..42a096dab1289e619b4676f6619331d48366684e 100644 (file)
@@ -31,7 +31,7 @@ namespace Mono.CSharp {
                        if (ec.IsInProbingMode)
                                return this;
 
-                       BlockContext bc = new BlockContext (ec.MemberContext, ec.CurrentBlock.Explicit, TypeManager.void_type) {
+                       BlockContext bc = new BlockContext (ec.MemberContext, ec.ConstructorBlock, TypeManager.void_type) {
                                CurrentAnonymousMethod = ec.CurrentAnonymousMethod
                        };
 
@@ -92,7 +92,7 @@ namespace Mono.CSharp {
 
                                ptypes [i] = d_param;
                                ImplicitLambdaParameter ilp = (ImplicitLambdaParameter) Parameters.FixedParameters [i];
-                               ilp.Type = d_param;
+                               ilp.SetParameterType (d_param);
                                ilp.Resolve (null, i);
                        }
 
@@ -100,24 +100,21 @@ namespace Mono.CSharp {
                        return Parameters;
                }
 
-               protected override Expression DoResolve (ResolveContext ec)
+               protected override AnonymousMethodBody CompatibleMethodFactory (TypeSpec returnType, TypeSpec delegateType, ParametersCompiled p, ParametersBlock b)
+               {
+                       return new LambdaMethod (p, b, returnType, delegateType, loc);
+               }
+
+               protected override bool DoResolveParameters (ResolveContext rc)
                {
                        //
                        // Only explicit parameters can be resolved at this point
                        //
                        if (HasExplicitParameters) {
-                               if (!Parameters.Resolve (ec))
-                                       return null;
+                               return Parameters.Resolve (rc);
                        }
 
-                       eclass = ExprClass.Value;
-                       type = InternalType.AnonymousMethod;
-                       return this;
-               }
-
-               protected override AnonymousMethodBody CompatibleMethodFactory (TypeSpec returnType, TypeSpec delegateType, ParametersCompiled p, ToplevelBlock b)
-               {
-                       return new LambdaMethod (p, b, returnType, delegateType, loc);
+                       return true;
                }
 
                public override string GetSignatureForError ()
@@ -126,19 +123,16 @@ namespace Mono.CSharp {
                }
        }
 
-       public class LambdaMethod : AnonymousMethodBody
+       class LambdaMethod : AnonymousMethodBody
        {
                public LambdaMethod (ParametersCompiled parameters,
-                                       ToplevelBlock block, TypeSpec return_type, TypeSpec delegate_type,
+                                       ParametersBlock block, TypeSpec return_type, TypeSpec delegate_type,
                                        Location loc)
                        : base (parameters, block, return_type, delegate_type, loc)
                {
                }
 
-               protected override void CloneTo (CloneContext clonectx, Expression target)
-               {
-                       // TODO: nothing ??
-               }
+               #region Properties
 
                public override string ContainerType {
                        get {
@@ -146,6 +140,13 @@ namespace Mono.CSharp {
                        }
                }
 
+               #endregion
+
+               protected override void CloneTo (CloneContext clonectx, Expression target)
+               {
+                       // TODO: nothing ??
+               }
+
                public override Expression CreateExpressionTree (ResolveContext ec)
                {
                        BlockContext bc = new BlockContext (ec.MemberContext, Block, ReturnType);