On 3/4/09, Jb Evain <[email protected]> wrote:
> It's indeed an issue with gmcs which miscompiles the using in TryFlattenArray.

This issue is fixed in Mono' HEAD. The fix is not going to be
backported to 2.4 though. Attached is a diff for the Mono branch which
work arounds the particular problem.

-- 
Jb Evain  <[email protected]>
diff --git a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/HashOps.cs b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/HashOps.cs
index 9fd5274..81b995c 100644
--- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/HashOps.cs
+++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/HashOps.cs
@@ -160,8 +160,8 @@ namespace IronRuby.Builtins {
 
         [RubyMethod("inspect")]
         public static MutableString/*!*/ Inspect(RubyContext/*!*/ context, Hash/*!*/ self) {
-
-            using (IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(self)) {
+			IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(self);
+            using (handle) {
                 if (handle == null) {
                     return MutableString.Create("{...}");
                 }
diff --git a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StructOps.cs b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StructOps.cs
index 1589aa0..4184791 100644
--- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StructOps.cs
+++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StructOps.cs
@@ -232,8 +232,8 @@ namespace IronRuby.Builtins {
         [RubyMethod("inspect")]
         public static MutableString/*!*/ Inspect(RubyStruct/*!*/ self) {
             RubyContext context = self.Class.Context;
-
-            using (IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(self)) {
+			IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(self);
+            using (handle) {
                 // #<struct Struct::Foo name=nil, val=nil>
                 var result = MutableString.CreateMutable();
                 result.Append("#<struct ");
diff --git a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IDictionaryOps.cs b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IDictionaryOps.cs
index 73d2b13..863e999 100644
--- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IDictionaryOps.cs
+++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IDictionaryOps.cs
@@ -324,8 +324,8 @@ namespace IronRuby.Builtins {
 
         [RubyMethod("inspect")]
         public static MutableString Inspect(RubyContext/*!*/ context, IDictionary<object, object>/*!*/ self) {
-
-            using (IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(self)) {
+			IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(self)
+            using (handle) {
                 if (handle == null) {
                     return MutableString.Create("{...}");
                 }
@@ -517,7 +517,8 @@ namespace IronRuby.Builtins {
 
         [RubyMethod("to_s")]
         public static MutableString ToString(UnaryOpStorage/*!*/ tosStorage, RubyContext/*!*/ context, IDictionary<object, object>/*!*/ self) {
-            using (IDisposable handle = RubyUtils.InfiniteToSTracker.TrackObject(self)) {
+			IDisposable handle = RubyUtils.InfiniteToSTracker.TrackObject(self)
+            using (handle) {
                 if (handle == null) {
                     return MutableString.Create("{...}");
                 } else {
diff --git a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs
index 3610f4a..84ec583 100644
--- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs
+++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IListOps.cs
@@ -909,7 +909,8 @@ namespace IronRuby.Builtins {
             // TODO: create correct subclass of RubyArray rather than RubyArray directly
             result = new RubyArray();
 
-            using (IDisposable handle = _infiniteFlattenTracker.TrackObject(list)) {
+			IDisposable handle = _infiniteFlattenTracker.TrackObject(list);
+            using (handle) {
                 if (handle == null) {
                     throw RubyExceptions.CreateArgumentError("tried to flatten recursive array");
                 }
@@ -1100,7 +1101,8 @@ namespace IronRuby.Builtins {
         [RubyMethod("inspect")]
         public static MutableString/*!*/ Inspect(RubyContext/*!*/ context, IList/*!*/ self) {
 
-            using (IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(self)) {
+			IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(self)
+            using (handle) {
                 if (handle == null) {
                     return MutableString.Create("[...]");
                 }
diff --git a/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs b/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs
index d8b2a6e..ebffe03 100644
--- a/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs
+++ b/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs
@@ -118,7 +118,8 @@ namespace IronRuby.Runtime {
         public static MutableString/*!*/ InspectObject(UnaryOpStorage/*!*/ inspectStorage, ConversionStorage<MutableString>/*!*/ tosStorage,
             RubyContext/*!*/ context, object obj) {
 
-            using (IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(obj)) {
+			IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(obj)
+            using (handle) {
                 if (handle == null) {
                     return MutableString.Create("...");
                 }
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to