Author: martin
Date: 2006-11-24 12:40:24 -0500 (Fri, 24 Nov 2006)
New Revision: 68437
Modified:
branches/martin/anonymous-methods2/mcs/anonymous.cs
branches/martin/anonymous-methods2/mcs/class.cs
branches/martin/anonymous-methods2/mcs/expression.cs
Log:
Modified: branches/martin/anonymous-methods2/mcs/anonymous.cs
===================================================================
--- branches/martin/anonymous-methods2/mcs/anonymous.cs 2006-11-24 17:39:24 UTC
(rev 68436)
+++ branches/martin/anonymous-methods2/mcs/anonymous.cs 2006-11-24 17:40:24 UTC
(rev 68437)
@@ -410,7 +410,8 @@
protected FieldInfo GetField (EmitContext ec)
{
- if (ec.CurrentBlock.Toplevel !=
Scope.ScopeBlock.Toplevel)
+ if ((ec.CurrentBlock != null) &&
+ (ec.CurrentBlock.Toplevel !=
Scope.ScopeBlock.Toplevel))
return Field.FieldBuilder;
else
return FieldInstance.FieldInfo;
@@ -626,10 +627,11 @@
protected virtual void DoEmit (EmitContext ec)
{
- if (ec.CurrentBlock.Toplevel ==
Scope.ScopeBlock.Toplevel)
+ if ((ec.CurrentBlock != null) &&
+ (ec.CurrentBlock.Toplevel !=
Scope.ScopeBlock.Toplevel))
+ ec.ig.Emit (OpCodes.Ldarg_0);
+ else
DoEmitInstance (ec);
- else
- ec.ig.Emit (OpCodes.Ldarg_0);
}
protected void DoEmitInstance (EmitContext ec)
Modified: branches/martin/anonymous-methods2/mcs/class.cs
===================================================================
--- branches/martin/anonymous-methods2/mcs/class.cs 2006-11-24 17:39:24 UTC
(rev 68436)
+++ branches/martin/anonymous-methods2/mcs/class.cs 2006-11-24 17:40:24 UTC
(rev 68437)
@@ -4747,6 +4747,11 @@
if (block != null) {
ec.ResolveTopBlock (null, block, ParameterInfo,
this, out unreachable);
ec.EmitMeta (block);
+
+ if (block.ScopeInfo != null) {
+ ExpressionStatement init =
block.ScopeInfo.GetScopeInitializer (ec);
+ init.EmitStatement (ec);
+ }
}
if (Initializer != null) {
Modified: branches/martin/anonymous-methods2/mcs/expression.cs
===================================================================
--- branches/martin/anonymous-methods2/mcs/expression.cs 2006-11-24
17:39:24 UTC (rev 68436)
+++ branches/martin/anonymous-methods2/mcs/expression.cs 2006-11-24
17:40:24 UTC (rev 68437)
@@ -6669,7 +6669,8 @@
}
RootScopeInfo host = block.Toplevel.RootScope;
- if ((host != null) && (!is_struct ||
host.IsIterator)) {
+ if ((host != null) && !ec.IsConstructor &&
+ (!is_struct || host.IsIterator)) {
variable = host.CaptureThis ();
type = variable.Type;
is_struct = false;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches