Permalink
Browse files

fix TypedExprTools handling of TIf

  • Loading branch information...
1 parent 1d3f7f7 commit 2ec16f865e59904908051d7cf65bab0f5023c0f9 @Simn Simn committed Mar 11, 2014
Showing with 2 additions and 2 deletions.
  1. +2 −2 std/haxe/macro/TypedExprTools.hx
View
4 std/haxe/macro/TypedExprTools.hx
@@ -62,7 +62,7 @@ class TypedExprTools {
case TCall(e1, el): with(e, TCall(f(e1), el.map(f)));
case TVar(v,eo): with(e, TVar(v, eo == null ? null : f(eo)));
case TFunction(fu): with(e, TFunction({ t: fu.t, args: fu.args, expr: f(fu.expr)}));
- case TIf(e1, e2, e3): with(e, TIf(f(e1), f(e2), f(e3)));
+ case TIf(e1, e2, e3): with(e, TIf(f(e1), f(e2), e3 == null ? null : f(e3)));
case TSwitch(e1, cases, e2): with(e, TSwitch(e1, cases.map(function(c) return { values: c.values, expr: f(c.expr) }), e2 == null ? null : f(e2)));
case TPatMatch: throw false;
case TTry(e1, catches): with(e, TTry(f(e1), catches.map(function(c) return { v:c.v, expr: f(c.expr) })));
@@ -101,7 +101,7 @@ class TypedExprTools {
case TCall(e1, el): with(e, TCall(f(e1), el.map(f)), ft(e.t));
case TVar(v,eo): with(e, TVar(fv(v), eo == null ? null : f(eo)), ft(e.t));
case TFunction(fu): with(e, TFunction({ t: ft(fu.t), args: fu.args.map(function(arg) return { v: fv(arg.v), value: arg.value }), expr: f(fu.expr)}), ft(e.t));
- case TIf(e1, e2, e3): with(e, TIf(f(e1), f(e2), f(e3)), ft(e.t));
+ case TIf(e1, e2, e3): with(e, TIf(f(e1), f(e2), e3 == null ? null : f(e3)), ft(e.t));
case TSwitch(e1, cases, e2): with(e, TSwitch(e1, cases.map(function(c) return { values: c.values, expr: f(c.expr) }), e2 == null ? null : f(e2)), ft(e.t));
case TPatMatch: throw false;
case TTry(e1, catches): with(e, TTry(f(e1), catches.map(function(c) return { v:fv(c.v), expr: f(c.expr) })), ft(e.t));

0 comments on commit 2ec16f8

Please sign in to comment.