Author: marek
Date: 2007-09-23 13:04:16 -0400 (Sun, 23 Sep 2007)
New Revision: 86243
Modified:
trunk/mcs/mcs/ChangeLog
trunk/mcs/mcs/anonymous.cs
trunk/mcs/mcs/codegen.cs
Log:
2007-09-23 Marek Safar <[EMAIL PROTECTED]>
* anonymous.cs, codegen.cs: Changed InferReturnType to be EmitContext
flag.
Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog 2007-09-23 15:25:47 UTC (rev 86242)
+++ trunk/mcs/mcs/ChangeLog 2007-09-23 17:04:16 UTC (rev 86243)
@@ -1,3 +1,8 @@
+2007-09-23 Marek Safar <[EMAIL PROTECTED]>
+
+ * anonymous.cs, codegen.cs: Changed InferReturnType to be EmitContext
+ flag.
+
2007-09-17 Marek Safar <[EMAIL PROTECTED]>
* class.cs: Use partial container to record whether any partial part
Modified: trunk/mcs/mcs/anonymous.cs
===================================================================
--- trunk/mcs/mcs/anonymous.cs 2007-09-23 15:25:47 UTC (rev 86242)
+++ trunk/mcs/mcs/anonymous.cs 2007-09-23 17:04:16 UTC (rev 86243)
@@ -1280,11 +1280,10 @@
public Type InferReturnType (EmitContext ec,
TypeInferenceContext tic, Type delegateType)
{
AnonymousMethod am;
- ec.InferReturnType = true;
- using (ec.Set (EmitContext.Flags.ProbingMode)) {
+ using (ec.Set (EmitContext.Flags.ProbingMode |
EmitContext.Flags.InferReturnType)) {
am = CompatibleMethod (ec, tic, GetType (),
delegateType);
}
- ec.InferReturnType = false;
+
if (am == null)
return null;
@@ -1531,9 +1530,10 @@
aec.CurrentAnonymousMethod = this;
aec.IsStatic = ec.IsStatic;
- aec.InferReturnType = ec.InferReturnType;
IDisposable aec_dispose = null;
+ if (ec.InferReturnType)
+ aec_dispose = aec.Set
(EmitContext.Flags.InferReturnType);
if (ec.IsInProbingMode)
aec_dispose = aec.Set
(EmitContext.Flags.ProbingMode);
if (ec.IsInFieldInitializer)
Modified: trunk/mcs/mcs/codegen.cs
===================================================================
--- trunk/mcs/mcs/codegen.cs 2007-09-23 15:25:47 UTC (rev 86242)
+++ trunk/mcs/mcs/codegen.cs 2007-09-23 17:04:16 UTC (rev 86243)
@@ -280,7 +280,9 @@
//
// Inside field intializer expression
//
- InFieldInitializer = 1 << 8
+ InFieldInitializer = 1 << 8,
+
+ InferReturnType = 1 << 9
}
Flags flags;
@@ -301,14 +303,6 @@
public bool MethodIsStatic;
/// <summary>
- /// If this is true, then Return and ContextualReturn
statements
- /// will set the ReturnType value based on the expression
types
- /// of each return statement instead of the method return type
- /// (which is initially null).
- /// </summary>
- public bool InferReturnType;
-
- /// <summary>
/// The value that is allowed to be returned or NULL if there
is no
/// return type.
/// </summary>
@@ -552,6 +546,16 @@
(omit_struct_analysis ?
Flags.OmitStructFlowAnalysis : 0);
return new FlagsHandle (this, Flags.DoFlowAnalysis |
Flags.OmitStructFlowAnalysis, newflags);
}
+
+ /// <summary>
+ /// If this is true, then Return and ContextualReturn
statements
+ /// will set the ReturnType value based on the expression
types
+ /// of each return statement instead of the method return type
+ /// (which is initially null).
+ /// </summary>
+ public bool InferReturnType {
+ get { return (flags & Flags.InferReturnType) != 0; }
+ }
public bool IsInObsoleteScope {
get {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches