Author: martin
Date: 2005-04-12 08:08:46 -0400 (Tue, 12 Apr 2005)
New Revision: 42826
Modified:
trunk/mcs/gmcs/ChangeLog
trunk/mcs/gmcs/anonymous.cs
trunk/mcs/gmcs/codegen.cs
trunk/mcs/gmcs/expression.cs
Log:
**** Merged r40523-r40541 from MCS ****
Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog 2005-04-12 12:07:40 UTC (rev 42825)
+++ trunk/mcs/gmcs/ChangeLog 2005-04-12 12:08:46 UTC (rev 42826)
@@ -1,5 +1,17 @@
2005-02-11 Miguel de Icaza <[EMAIL PROTECTED]>
+ * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
+ variable. This one is represents the actual low-level declaration
+ of the method, as opposed to the semantic level `IsStatic'.
+
+ An anonymous method which is hosted into a static method might be
+ actually an instance method. IsStatic would reflect the
+ container, while MethodIsStatic represents the actual code
+ generated.
+
+ * expression.cs (ParameterReference): Use the new MethodIsStatic
+ instead of IsStatic.
+
* anonymous.cs (AnonymousMethod.Compatible): Pass the
Modifiers.STATIC to the Anonymous' Method EmitContext if static is
set on the current EmitContext.
Modified: trunk/mcs/gmcs/anonymous.cs
===================================================================
--- trunk/mcs/gmcs/anonymous.cs 2005-04-12 12:07:40 UTC (rev 42825)
+++ trunk/mcs/gmcs/anonymous.cs 2005-04-12 12:08:46 UTC (rev 42826)
@@ -123,8 +123,9 @@
throw new Exception ("Type host is null");
if (current_type == type_host && ec.IsStatic){
- if (ec.IsStatic)
+ if (ec.IsStatic){
method_modifiers |= Modifiers.STATIC;
+ }
current_type = null;
}
@@ -134,7 +135,6 @@
method_modifiers, false, new MemberName
("<#AnonymousMethod>" + anonymous_method_count++),
Parameters, null, loc);
method.Block = Block;
-
//
// Swap the TypeBuilder while we define the method,
then restore
@@ -310,8 +310,7 @@
// Adjust based on the computed state of the
// method from CreateMethodHost
- if ((method_modifiers & Modifiers.STATIC) != 0)
- aec.IsStatic = true;
+ aec.MethodIsStatic = (method_modifiers &
Modifiers.STATIC) != 0;
aec.EmitMeta (Block, amp);
aec.EmitResolvedTopBlock (Block, unreachable);
Modified: trunk/mcs/gmcs/codegen.cs
===================================================================
--- trunk/mcs/gmcs/codegen.cs 2005-04-12 12:07:40 UTC (rev 42825)
+++ trunk/mcs/gmcs/codegen.cs 2005-04-12 12:08:46 UTC (rev 42826)
@@ -292,6 +292,16 @@
public bool IsStatic;
/// <summary>
+ /// Whether the actual created method is static or instance
method.
+ /// Althoug the method might be declared as `static', if an
anonymous
+ /// method is involved, we might turn this into an instance
method.
+ ///
+ /// So this reflects the low-level staticness of the method,
while
+ /// IsStatic represents the semantic, high-level staticness.
+ /// </summary>
+ public bool MethodIsStatic;
+
+ /// <summary>
/// Whether we are emitting a field initializer
/// </summary>
public bool IsFieldInitializer;
@@ -423,7 +433,6 @@
}
Phase current_phase;
-
FlowBranching current_flow_branching;
public EmitContext (DeclSpace parent, DeclSpace ds, Location l,
ILGenerator ig,
@@ -440,6 +449,7 @@
throw new Exception ("FUCK");
IsStatic = (code_flags & Modifiers.STATIC) != 0;
+ MethodIsStatic = IsStatic;
InIterator = (code_flags & Modifiers.METHOD_YIELDS) !=
0;
RemapToProxy = InIterator;
ReturnType = return_type;
Modified: trunk/mcs/gmcs/expression.cs
===================================================================
--- trunk/mcs/gmcs/expression.cs 2005-04-12 12:07:40 UTC (rev 42825)
+++ trunk/mcs/gmcs/expression.cs 2005-04-12 12:08:46 UTC (rev 42826)
@@ -4026,8 +4026,9 @@
ILGenerator ig = ec.ig;
int arg_idx = idx;
- if (!ec.IsStatic)
+ if (!ec.MethodIsStatic)
arg_idx++;
+
EmitLdArg (ig, arg_idx);
@@ -4051,7 +4052,7 @@
ILGenerator ig = ec.ig;
int arg_idx = idx;
- if (!ec.IsStatic)
+ if (!ec.MethodIsStatic)
arg_idx++;
EmitLdArg (ig, arg_idx);
@@ -4089,7 +4090,7 @@
prepared = prepare_for_load;
- if (!ec.IsStatic)
+ if (!ec.MethodIsStatic)
arg_idx++;
if (is_ref && !prepared)
@@ -4127,7 +4128,7 @@
int arg_idx = idx;
- if (!ec.IsStatic)
+ if (!ec.MethodIsStatic)
arg_idx++;
if (is_ref){
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches