/** Given generalized if expression, desugar into __cond calls (binding) where required. */ @Override public Node forIf(If i) { List<IfClause> clauses = i.getClauses(); int n = clauses.size(); if (n <= 0) bug(i, "if with no clauses!"); for (IfClause c : clauses) { if (c.getTestClause().getBind().size() == 0) continue; // If we get here we have a generalized if. // Desugar it into nested ifs and calls. // Then return the desugared result. Expr result = null; if (i.getElseClause().isSome()) { result = i.getElseClause().unwrap(); } // Traverse each clause and desugar it into an if or a __cond as appropriate. for (--n; n >= 0; --n) { result = addIfClause(clauses.get(n), result); } return result; } // If we get here, it's not a generalized if. Just recur. return super.forIf(i); }