[svn] r6415: nemerle/trunk/ncc/generation/ILEmitter.n

nazgul svnadmin at nemerle.org
Sun Jul 2 12:25:01 CEST 2006


Log:
Do not perform unnecessary castclass operations. Patch by Snaury

Author: nazgul
Date: Sun Jul  2 12:24:59 2006
New Revision: 6415

Modified:
   nemerle/trunk/ncc/generation/ILEmitter.n

Modified: nemerle/trunk/ncc/generation/ILEmitter.n
==============================================================================
--- nemerle/trunk/ncc/generation/ILEmitter.n	(original)
+++ nemerle/trunk/ncc/generation/ILEmitter.n	Sun Jul  2 12:24:59 2006
@@ -715,7 +715,7 @@
           }
         
         /* to nonvalue type */
-        | TypeConversion (expr, cast_to_type, _) when !cast_to_type.Fix ().IsValueType =>
+        | TypeConversion (expr, cast_to_type, kind) when !cast_to_type.Fix ().IsValueType =>
           emit (expr);
           if (is_void (expr.Type))
             /* special case casts from void */
@@ -744,6 +744,7 @@
               Message.Error (expr.loc, $ "attempting to cast a value type array "
                                          "$(expr.SystemType) to non-value type array "
                                          "$(cast_to_type) which cannot succeed");
+            unless (kind is ConversionKind.UpCast)
             _ilg.Emit (OpCodes.Castclass, cast_to_type);
           }
 



More information about the svn mailing list