public override IUnboundExpr Transform(LetExpr expr) { // a let expression desugars like this: // // let a b <- Foo then Bar else Bang // // becomes... // // def let__ <- Foo // if Some? let__ then // def a b <- 0 SomeValue let__ // Bar // else Bang var c = new CodeBuilder(mNameGenerator, expr.Position); var option = c.TempName(); return(c.Block( c.Def(option, expr.Condition), c.If(c.Call("Some?", option), c.Block( c.Def(expr.Names, c.Call("SomeValue", option)), expr.ThenBody), expr.ElseBody))); }
public virtual IUnboundExpr Transform(LetExpr expr) { return(expr); }
IBoundExpr IUnboundExprVisitor<IBoundExpr>.Visit(LetExpr expr) { throw new NotSupportedException("Let expressions should be desugared to more primitive expressions before binding."); }
IUnboundExpr IUnboundExprVisitor <IUnboundExpr> .Visit(LetExpr expr) { throw new NotImplementedException(); }