[671878] Fixes IKVM ordering of catch clauses
authorMarek Safar <marek.safar@gmail.com>
Tue, 15 Feb 2011 14:29:07 +0000 (14:29 +0000)
committerMarek Safar <marek.safar@gmail.com>
Tue, 15 Feb 2011 14:30:28 +0000 (14:30 +0000)
mcs/class/IKVM.Reflection/Emit/ILGenerator.cs

index 0f086b22f6e455ea7525e7d51d7b7c569d44e40a..4f7e2489342b549b50d18983130fd58576fb6a41 100644 (file)
@@ -166,33 +166,21 @@ namespace IKVM.Reflection.Emit
                                {
                                        return 0;
                                }
-                               if (x.tryOffset >= y.handlerOffset && x.tryOffset + x.tryLength <= y.handlerOffset + y.handlerLength)
-                               {
-                                       return -1;
-                               }
-                               if (y.tryOffset >= x.handlerOffset && y.tryOffset + y.tryLength <= x.handlerOffset + x.handlerLength)
-                               {
-                                       return 1;
-                               }
-                               if (x.tryOffset == y.tryOffset && x.tryLength == y.tryLength)
+                               else if (x.tryOffset == y.tryOffset && x.tryLength == y.tryLength)
                                {
                                        return x.ordinal < y.ordinal ? -1 : 1;
                                }
-                               if (x.tryOffset + x.tryLength <= y.tryOffset)
+                               else if (x.tryOffset >= y.tryOffset && x.handlerOffset + x.handlerLength <= y.handlerOffset + y.handlerLength)
                                {
                                        return -1;
                                }
-                               if (y.tryOffset + y.tryLength <= x.tryOffset)
+                               else if (y.tryOffset >= x.tryOffset && y.handlerOffset + y.handlerLength <= x.handlerOffset + x.handlerLength)
                                {
                                        return 1;
                                }
-                               if (x.tryOffset > y.tryOffset || (x.tryOffset == y.tryOffset && x.tryLength < y.tryLength))
-                               {
-                                       return -1;
-                               }
                                else
                                {
-                                       return 1;
+                                       return x.ordinal < y.ordinal ? -1 : 1;
                                }
                        }
                }