summaryrefslogtreecommitdiff
path: root/Dafny/Printer.ssc
diff options
context:
space:
mode:
authorGravatar rustanleino <unknown>2010-03-11 07:08:51 +0000
committerGravatar rustanleino <unknown>2010-03-11 07:08:51 +0000
commita406d2b8a42355a1924c00b67d8b08962efd9de1 (patch)
tree388962d66888984aed09f7d33def92639c29a617 /Dafny/Printer.ssc
parent2bfb81bd10f969ad2834be5b6604606ad9c14dab (diff)
Dafny:
* Enforce ghost vs. non-ghost separation * Allow ghost parameters and ghost locals * Functions are ghost, but allow the non-ghost "function method"
Diffstat (limited to 'Dafny/Printer.ssc')
-rw-r--r--Dafny/Printer.ssc8
1 files changed, 8 insertions, 0 deletions
diff --git a/Dafny/Printer.ssc b/Dafny/Printer.ssc
index 23e6dfce..93b793f2 100644
--- a/Dafny/Printer.ssc
+++ b/Dafny/Printer.ssc
@@ -128,6 +128,7 @@ namespace Microsoft.Dafny {
string k = "function";
if (f.IsUse) { k = "use " + k; }
if (f.IsClass) { k = "class " + k; }
+ if (!f.IsGhost) { k += " method"; }
PrintClassMethodHelper(k, f.Attributes, f.Name, f.TypeArgs);
PrintFormals(f.Formals);
wr.Write(": ");
@@ -175,6 +176,7 @@ namespace Microsoft.Dafny {
Indent(IndentAmount);
string k = "method";
if (method.IsClass) { k = "class " + k; }
+ if (method.IsGhost) { k = "ghost " + k; }
PrintClassMethodHelper(k, method.Attributes, method.Name, method.TypeArgs);
PrintFormals(method.Ins);
if (method.Outs.Count != 0) {
@@ -213,6 +215,9 @@ namespace Microsoft.Dafny {
}
void PrintFormal(Formal! f) {
+ if (f.IsGhost) {
+ wr.Write("ghost ");
+ }
if (!f.Name.StartsWith("#")) {
wr.Write("{0}: ", f.Name);
}
@@ -303,6 +308,9 @@ namespace Microsoft.Dafny {
} else if (stmt is VarDecl) {
VarDecl s = (VarDecl)stmt;
+ if (s.IsGhost) {
+ wr.Write("ghost ");
+ }
wr.Write("var {0}", s.Name);
if (s.OptionalType != null) {
wr.Write(": ");