summaryrefslogtreecommitdiff
path: root/Source/Dafny/Compiler.cs
diff options
context:
space:
mode:
authorGravatar chmaria <unknown>2014-11-01 13:59:31 +0100
committerGravatar chmaria <unknown>2014-11-01 13:59:31 +0100
commit6e5fb70941531435489c1dc533d7caea9120a3d5 (patch)
tree4b575de9ef5c17bdf61c805233adbdb2360d0f4c /Source/Dafny/Compiler.cs
parent9f41b35b514eba87a037cbada83f0c294eafb936 (diff)
Added initial support for dirty while statements.
Diffstat (limited to 'Source/Dafny/Compiler.cs')
-rw-r--r--Source/Dafny/Compiler.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/Source/Dafny/Compiler.cs b/Source/Dafny/Compiler.cs
index 9d2cad2f..0c670062 100644
--- a/Source/Dafny/Compiler.cs
+++ b/Source/Dafny/Compiler.cs
@@ -1120,6 +1120,11 @@ namespace Microsoft.Dafny {
if (s.Body == null) {
compiler.Error("a forall statement without a body cannot be compiled (line {0})", stmt.Tok.line);
}
+ } else if (stmt is WhileStmt) {
+ var s = (WhileStmt)stmt;
+ if (s.Body == null) {
+ compiler.Error("a while statement without a body cannot be compiled (line {0})", stmt.Tok.line);
+ }
}
}
}
@@ -1388,6 +1393,9 @@ namespace Microsoft.Dafny {
} else if (stmt is WhileStmt) {
WhileStmt s = (WhileStmt)stmt;
+ if (s.Body == null) {
+ return;
+ }
if (s.Guard == null) {
Indent(indent);
wr.WriteLine("while (false) { }");
@@ -2515,7 +2523,7 @@ namespace Microsoft.Dafny {
var rhsName = string.Format("_pat_let{0}_{1}", GetUniqueAstNumber(e), i);
wr.Write("Dafny.Helpers.Let<");
wr.Write(TypeName(e.RHSs[i].Type) + "," + TypeName(e.Body.Type));
- wr.Write(">(");
+ wr.Write(">(");
TrExpr(e.RHSs[i]);
wr.Write(", " + rhsName + " => ");
neededCloseParens++;