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/vacid0 | |
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/vacid0')
-rw-r--r-- | Test/vacid0/Composite.dfy | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/Test/vacid0/Composite.dfy b/Test/vacid0/Composite.dfy index 87e63e2c..95ad12fa 100644 --- a/Test/vacid0/Composite.dfy +++ b/Test/vacid0/Composite.dfy @@ -135,18 +135,14 @@ class Composite { method Main()
{
- var c0 := new Composite;
- call c0.Init(57);
+ var c0 := new Composite.Init(57);
- var c1 := new Composite;
- call c1.Init(12);
+ var c1 := new Composite.Init(12);
call c0.Add({c0}, c1, {c1});
- var c2 := new Composite;
- call c2.Init(48);
+ var c2 := new Composite.Init(48);
- var c3 := new Composite;
- call c3.Init(48);
+ var c3 := new Composite.Init(48);
call c2.Add({c2}, c3, {c3});
call c0.Add({c0,c1}, c2, {c2,c3});
@@ -160,15 +156,15 @@ method Main() }
method Harness() {
- var a := new Composite; call a.Init(5);
- var b := new Composite; call b.Init(7);
+ var a := new Composite.Init(5);
+ var b := new Composite.Init(7);
call a.Add({a}, b, {b});
assert a.sum == 12;
call b.Update(17, {a,b});
assert a.sum == 22;
- var c := new Composite; call c.Init(10);
+ var c := new Composite.Init(10);
call b.Add({a,b}, c, {c});
call b.Dislodge({a,b,c});
assert b.sum == 27;
|