Permalink
Browse files

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

  • Loading branch information...
1 parent 025a6e6 commit 51face190e9bd9dd037ca879f31cf777f8aa4f32 @sorear sorear committed Aug 19, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 lib/CodeGen.cs
View
2 lib/CodeGen.cs
@@ -2693,6 +2693,8 @@ class NamProcessor {
handlers["unbox"] = delegate(NamProcessor th, object[] zyg) {
Type t = namtype(zyg[1]);
CpsOp unboxee = th.Scan(zyg[2]);
+ if (unboxee.head.Returns == Tokens.Variable)
+ unboxee = CpsOp.MethodCall(Tokens.Variable_Fetch, unboxee);
return CpsOp.MethodCall(Tokens.Kernel.GetMethod("UnboxAny").MakeGenericMethod(t), unboxee);
};
handlers["newboundvar"] = delegate(NamProcessor th, object[] zyg) {

0 comments on commit 51face1

Please sign in to comment.