Skip to content

Commit c4eefc7

Browse files
committed
Remove the bind to vardecl desugaring from Translator.dfy
1 parent e7c9f35 commit c4eefc7

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/AST/Translator.dfy

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,6 @@ module Bootstrap.AST.Translator {
182182
(map k | k in LazyBinopMap :: DE.Lazy(LazyBinopMap[k])) +
183183
(map k | k in EagerBinopMap :: DE.Eager(DE.BinaryOp(EagerBinopMap[k])))
184184

185-
// Do we desugar binds to variable declarations?
186-
const bindToVarDecl: bool := false
187-
188185
// Wo we wrap the content of `if then else` branches in blocks?
189186
const wrapBranchesInBlocks: bool := true
190187

@@ -433,7 +430,7 @@ module Bootstrap.AST.Translator {
433430
Success(DE.Abs(bvars, body))
434431
}
435432

436-
function method TranslateLetExpr(as_bind: bool, le: C.LetExpr)
433+
function method TranslateLetExpr(le: C.LetExpr)
437434
: (e: TranslationResult<Expr>)
438435
reads *
439436
decreases ASTHeight(le), 0
@@ -452,13 +449,7 @@ module Bootstrap.AST.Translator {
452449
:- Need(|bvs| == |elems|, UnsupportedExpr(le));
453450
assume Decreases(le.Body, le);
454451
var body :- TranslateExpression(le.Body);
455-
if as_bind then
456-
Success(DE.Bind(bvs, elems, body))
457-
else
458-
var vdecl := DE.VarDecl(bvs, DE.Some(elems));
459-
var block := DE.Block([vdecl, body]);
460-
assert P.All_Expr(block, DE.WellFormed); // Doesn't work without this assertion
461-
Success(block)
452+
Success(DE.Bind(bvs, elems, body))
462453
}
463454

464455
function method TranslateConcreteSyntaxExpression(ce: C.ConcreteSyntaxExpression)
@@ -517,7 +508,7 @@ module Bootstrap.AST.Translator {
517508
else if c is C.LambdaExpr then
518509
TranslateLambdaExpr(c as C.LambdaExpr)
519510
else if c is C.LetExpr then
520-
TranslateLetExpr(bindToVarDecl, c as C.LetExpr)
511+
TranslateLetExpr(c as C.LetExpr)
521512
else if c is C.ITEExpr then
522513
TranslateITEExpr(c as C.ITEExpr)
523514
else if c is C.ConcreteSyntaxExpression then

0 commit comments

Comments
 (0)