summaryrefslogtreecommitdiff
path: root/Source/Dafny/Compiler.cs
diff options
context:
space:
mode:
authorGravatar Rustan Leino <unknown>2013-02-20 17:38:56 -0800
committerGravatar Rustan Leino <unknown>2013-02-20 17:38:56 -0800
commitd26d672bb7cfea66721d4a819477f3a7541d4631 (patch)
tree490862b3b0f52367d217743752f07a88c72774ec /Source/Dafny/Compiler.cs
parent5c5d0318c70d53eb8b287b07edfce96b6888a540 (diff)
Added Equals method on Type
Fixed some precondition violations Various improvements in Contracts
Diffstat (limited to 'Source/Dafny/Compiler.cs')
-rw-r--r--Source/Dafny/Compiler.cs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/Dafny/Compiler.cs b/Source/Dafny/Compiler.cs
index d5bf1ecf..60084fb8 100644
--- a/Source/Dafny/Compiler.cs
+++ b/Source/Dafny/Compiler.cs
@@ -54,6 +54,7 @@ namespace Microsoft.Dafny {
readonly int IndentAmount = 2;
void Indent(int ind) {
+ Contract.Requires(0 <= ind);
string spaces = " ";
for (; spaces.Length < ind; ind -= spaces.Length) {
wr.Write(spaces);
@@ -61,7 +62,8 @@ namespace Microsoft.Dafny {
wr.Write(spaces.Substring(0, ind));
}
- public void Compile(Program program) {Contract.Requires(program != null);
+ public void Compile(Program program) {
+ Contract.Requires(program != null);
wr.WriteLine("// Dafny program {0} compiled into C#", program.Name);
wr.WriteLine();
ReadRuntimeSystem();
@@ -757,6 +759,7 @@ namespace Microsoft.Dafny {
}
void CompileReturnBody(Expression body, int indent) {
+ Contract.Requires(0 <= indent);
body = body.Resolved;
if (body is MatchExpr) {
MatchExpr me = (MatchExpr)body;
@@ -1693,6 +1696,7 @@ namespace Microsoft.Dafny {
Contract.Requires(sourceType != null);
Contract.Requires(ctor != null);
Contract.Requires(cce.NonNullElements(arguments));
+ Contract.Requires(0 <= indent);
// if (source.is_Ctor0) {
// FormalType f0 = ((Dt_Ctor0)source._D).a0;
// ...