Skip to content
This repository
Browse code

Auto-fetch in (unbox) to reduce boilerplace a bit

  • Loading branch information...
commit 51face190e9bd9dd037ca879f31cf777f8aa4f32 1 parent 025a6e6
sorear authored August 20, 2012

Showing 1 changed file with 2 additions and 0 deletions. Show diff stats Hide diff stats

  1. 2  lib/CodeGen.cs
2  lib/CodeGen.cs
@@ -2693,6 +2693,8 @@ class NamProcessor {
2693 2693
             handlers["unbox"] = delegate(NamProcessor th, object[] zyg) {
2694 2694
                 Type t = namtype(zyg[1]);
2695 2695
                 CpsOp unboxee = th.Scan(zyg[2]);
  2696
+                if (unboxee.head.Returns == Tokens.Variable)
  2697
+                    unboxee = CpsOp.MethodCall(Tokens.Variable_Fetch, unboxee);
2696 2698
                 return CpsOp.MethodCall(Tokens.Kernel.GetMethod("UnboxAny").MakeGenericMethod(t), unboxee);
2697 2699
             };
2698 2700
             handlers["newboundvar"] = delegate(NamProcessor th, object[] zyg) {

0 notes on commit 51face1

Please sign in to comment.
Something went wrong with that request. Please try again.