summaryrefslogtreecommitdiff
path: root/Source/Dafny/Printer.cs
diff options
context:
space:
mode:
authorGravatar Rustan Leino <unknown>2013-08-06 01:45:25 -0700
committerGravatar Rustan Leino <unknown>2013-08-06 01:45:25 -0700
commit739d4aeff0124e69e30f17880d403b59fd008670 (patch)
tree1a436de11ba882c1e0f4adba368d7d8231ff7f8b /Source/Dafny/Printer.cs
parentfdfb22a0ca1d352c666f56798f9fa997c33db3fa (diff)
Merged PredicateExpr and CalcExpr into a single StmtExpr
In that process, added a SubstStmt method (and entourage) for substituting into statements
Diffstat (limited to 'Source/Dafny/Printer.cs')
-rw-r--r--Source/Dafny/Printer.cs22
1 files changed, 5 insertions, 17 deletions
diff --git a/Source/Dafny/Printer.cs b/Source/Dafny/Printer.cs
index 35f4a8e7..b82a7169 100644
--- a/Source/Dafny/Printer.cs
+++ b/Source/Dafny/Printer.cs
@@ -1409,25 +1409,13 @@ namespace Microsoft.Dafny {
} else if (expr is WildcardExpr) {
wr.Write("*");
- } else if (expr is PredicateExpr) {
- var e = (PredicateExpr)expr;
+ } else if (expr is StmtExpr) {
+ var e = (StmtExpr)expr;
bool parensNeeded = !isRightmost;
if (parensNeeded) { wr.Write("("); }
- wr.Write("{0} ", e.Kind);
- PrintExpression(e.Guard);
- wr.Write("; ");
- PrintExpression(e.Body);
- if (parensNeeded) { wr.Write(")"); }
-
- } else if (expr is CalcExpr) {
- var e = (CalcExpr)expr;
- bool parensNeeded = !isRightmost;
- if (parensNeeded) { wr.Write("("); }
- int ind = indent < 0 ? IndentAmount : indent; // if the expression was to be printed on one line, instead print the calc statement part at indentation IndentAmount (not pretty, but something)
- PrintStatement(e.Guard, ind);
- wr.WriteLine();
- Indent(ind);
- PrintExpression(e.Body);
+ int ind = indent < 0 ? IndentAmount : indent; // if the expression was to be printed on one line, instead print the .S part at indentation IndentAmount (not pretty, but something)
+ PrintStatement(e.S, ind);
+ PrintExpression(e.E);
if (parensNeeded) { wr.Write(")"); }
} else if (expr is ITEExpr) {