[svn] r6475: nemerle/trunk/ncc/generation: DecisionTreeCompiler.n Typer4.n

nazgul svnadmin at nemerle.org
Fri Jul 28 22:14:29 CEST 2006


Log:
Fix boxing in match clauses

Author: nazgul
Date: Fri Jul 28 22:14:26 2006
New Revision: 6475

Modified:
   nemerle/trunk/ncc/generation/DecisionTreeCompiler.n
   nemerle/trunk/ncc/generation/Typer4.n

Modified: nemerle/trunk/ncc/generation/DecisionTreeCompiler.n
==============================================================================
--- nemerle/trunk/ncc/generation/DecisionTreeCompiler.n	(original)
+++ nemerle/trunk/ncc/generation/DecisionTreeCompiler.n	Fri Jul 28 22:14:26 2006
@@ -430,7 +430,11 @@
 
     static Cast (expr : TExpr, ty : TyVar) : TExpr
     {
-      TExpr.TypeConversion (expr.Location, ty, expr, ty.Fix (), ConversionKind.IL (true))
+      def ty = ty.Fix ();
+      if (Typer4.NeedBoxing (ty, expr))
+        TExpr.TypeConversion (expr.Location, ty, expr, ty, ConversionKind.Boxing())
+      else
+        TExpr.TypeConversion (expr.Location, ty, expr, ty, ConversionKind.IL (true))
     }
 
     static Sequence (e1 : TExpr, e2 : TExpr) : TExpr

Modified: nemerle/trunk/ncc/generation/Typer4.n
==============================================================================
--- nemerle/trunk/ncc/generation/Typer4.n	(original)
+++ nemerle/trunk/ncc/generation/Typer4.n	Fri Jul 28 22:14:26 2006
@@ -108,7 +108,7 @@
     }
 
 
-    static NeedBoxing (target_type : MType, expr : TExpr) : bool
+    internal static NeedBoxing (target_type : MType, expr : TExpr) : bool
     {
       def src = expr.Type.Fix ();
 



More information about the svn mailing list