diff options
author | rustanleino <unknown> | 2011-03-27 18:00:28 +0000 |
---|---|---|
committer | rustanleino <unknown> | 2011-03-27 18:00:28 +0000 |
commit | 4f0a7156a61ae3d16b8f716a23ac3f3dd596ab86 (patch) | |
tree | f2a3317d19001575441f6208c29e04b4ea05c714 /Test/dafny1/Queue.dfy | |
parent | d06300cc9bc9f9c7002fb8e555cf172053cdfa5c (diff) |
Dafny: Added support for an initializing call as part of the new-allocation syntax. What you previously would have written like:
c := new C;
call c.Init(x, y);
you can now write as:
c := new C.Init(x, y);
Diffstat (limited to 'Test/dafny1/Queue.dfy')
-rw-r--r-- | Test/dafny1/Queue.dfy | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Test/dafny1/Queue.dfy b/Test/dafny1/Queue.dfy index 42b7dd64..0ee953e1 100644 --- a/Test/dafny1/Queue.dfy +++ b/Test/dafny1/Queue.dfy @@ -33,8 +33,7 @@ class Queue<T> { ensures Valid() && fresh(footprint - {this});
ensures |contents| == 0;
{
- var n := new Node<T>;
- call n.Init();
+ var n := new Node<T>.Init();
head := n;
tail := n;
contents := n.tailContents;
@@ -81,8 +80,8 @@ class Queue<T> { ensures Valid() && fresh(footprint - old(footprint));
ensures contents == old(contents) + [t];
{
- var n := new Node<T>;
- call n.Init(); n.data := t;
+ var n := new Node<T>.Init();
+ n.data := t;
tail.next := n;
tail := n;
@@ -150,10 +149,8 @@ class Node<T> { class Main<U> {
method A<T>(t: T, u: T, v: T)
{
- var q0 := new Queue<T>;
- call q0.Init();
- var q1 := new Queue<T>;
- call q1.Init();
+ var q0 := new Queue<T>.Init();
+ var q1 := new Queue<T>.Init();
call q0.Enqueue(t);
call q0.Enqueue(u);
|