2002-07-19 Martin Baulig <martin@gnome.org>
authorMartin Baulig <martin@novell.com>
Fri, 19 Jul 2002 13:32:57 +0000 (13:32 -0000)
committerMartin Baulig <martin@novell.com>
Fri, 19 Jul 2002 13:32:57 +0000 (13:32 -0000)
* expression.cs (New.DoEmit): Create a new LocalTemporary each time
this function is called, it's not allowed to share LocalBuilders
among ILGenerators.

svn path=/trunk/mcs/; revision=5916

mcs/mcs/ChangeLog
mcs/mcs/expression.cs

index 669704a41dcca9c50fecc1bfadd31f4127648bca..82d24154e0c75b588fccafab1701c18555c22bde 100755 (executable)
@@ -1,3 +1,9 @@
+2002-07-19  Martin Baulig  <martin@gnome.org>
+
+       * expression.cs (New.DoEmit): Create a new LocalTemporary each time
+       this function is called, it's not allowed to share LocalBuilders
+       among ILGenerators.
+
 2002-07-19  Martin Baulig  <martin@gnome.org>
 
        * expression.cs (Argument.Resolve): Report an error 118 when trying
index 3960746138569cb56752e7d9938aa193111f9628..f021a6bae8803a6df6d855ceabe9d34ccc1b0fbb 100755 (executable)
@@ -3991,6 +3991,7 @@ namespace Mono.CSharp {
                // we will not leave anything on the stack.
                //
                Expression value_target;
+               bool value_target_set = false;
                
                public New (Expression requested_type, ArrayList arguments, Location l)
                {
@@ -4006,6 +4007,7 @@ namespace Mono.CSharp {
 
                        set {
                                value_target = value;
+                               value_target_set = true;
                        }
                }
 
@@ -4137,7 +4139,10 @@ namespace Mono.CSharp {
                        if (is_value_type){
                                IMemoryLocation ml;
 
-                               if (value_target == null)
+                               // Allow DoEmit() to be called multiple times.
+                               // We need to create a new LocalTemporary each time since
+                               // you can't share LocalBuilders among ILGeneators.
+                               if (!value_target_set)
                                        value_target = new LocalTemporary (ec, type);
                                        
                                ml = (IMemoryLocation) value_target;