summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Rustan Leino <leino@microsoft.com>2011-10-26 21:49:27 -0700
committerGravatar Rustan Leino <leino@microsoft.com>2011-10-26 21:49:27 -0700
commite7bf7ffb17f0c4022c3df81b4fe33df440723c37 (patch)
treeef9bb4de480371a5b5f3897a3c9f30fe04e84518
parent8f0b71a95305b32ccded390ec5117462ffcadef0 (diff)
Dafny: allow attributes on function/method declarations to refer to the (in- and out-)parameters
-rw-r--r--Dafny/Resolver.cs7
1 files changed, 6 insertions, 1 deletions
diff --git a/Dafny/Resolver.cs b/Dafny/Resolver.cs
index a3668619..5d806aa9 100644
--- a/Dafny/Resolver.cs
+++ b/Dafny/Resolver.cs
@@ -413,8 +413,8 @@ namespace Microsoft.Dafny {
ResolveAttributes(cl.Attributes, false);
currentClass = cl;
foreach (MemberDecl member in cl.Members) {
- ResolveAttributes(member.Attributes, false);
if (member is Field) {
+ ResolveAttributes(member.Attributes, false);
// nothing more to do
} else if (member is Function) {
@@ -457,6 +457,7 @@ namespace Microsoft.Dafny {
} else if (member is CouplingInvariant) {
CouplingInvariant inv = (CouplingInvariant)member;
+ ResolveAttributes(member.Attributes, false);
if (inv.Refined != null) {
inv.Formals = new List<Formal>();
scope.PushMarker();
@@ -649,6 +650,7 @@ namespace Microsoft.Dafny {
foreach (Formal p in f.Formals) {
scope.Push(p.Name, p);
}
+ ResolveAttributes(f.Attributes, false);
foreach (Expression r in f.Req) {
ResolveExpression(r, false);
Contract.Assert(r.Type != null); // follows from postcondition of ResolveExpression
@@ -779,6 +781,9 @@ namespace Microsoft.Dafny {
scope.Push(p.Name, p);
}
+ // attributes are allowed to mention both in- and out-parameters
+ ResolveAttributes(m.Attributes, false);
+
// ... continue resolving specification
foreach (MaybeFreeExpression e in m.Ens) {
ResolveExpression(e.E, true);