summaryrefslogtreecommitdiff
path: root/Source/Core/Absy.cs
diff options
context:
space:
mode:
authorGravatar 0biha <unknown>2014-12-15 17:05:25 +0100
committerGravatar 0biha <unknown>2014-12-15 17:05:25 +0100
commitffa1e5ea550a6f3c4e88c1fe82691ca128bafd84 (patch)
treeb253999bf6600e0047616affc9cc91c3b48eb333 /Source/Core/Absy.cs
parentf3a090c00f6d40e6020d1c6a2b5f8e822b8375ef (diff)
Made invariant of class 'Choice' robust by changing the design (replaced public field by private field + getter/setter).
Diffstat (limited to 'Source/Core/Absy.cs')
-rw-r--r--Source/Core/Absy.cs19
1 files changed, 16 insertions, 3 deletions
diff --git a/Source/Core/Absy.cs b/Source/Core/Absy.cs
index b2966c0b..fe0c80d1 100644
--- a/Source/Core/Absy.cs
+++ b/Source/Core/Absy.cs
@@ -4258,14 +4258,27 @@ namespace Microsoft.Boogie {
public class Choice : CompoundRE {
[ContractInvariantMethod]
void ObjectInvariant() {
- Contract.Invariant(rs != null);
+ Contract.Invariant(this._rs != null);
+ }
+
+ private List<RE>/*!*/ _rs;
+
+ public List<RE>/*!*/ rs { //Rename this (and _rs) if possible
+ get {
+ Contract.Ensures(Contract.Result<List<RE>>() != null);
+ return this._rs;
+ }
+ set {
+ Contract.Requires(value != null);
+ this._rs = value;
+ }
}
- public List<RE>/*!*/ rs;
public Choice(List<RE> operands) {
Contract.Requires(operands != null);
- rs = operands;
+ this._rs = operands;
}
+
public override void Emit(TokenTextWriter stream, int level) {
//Contract.Requires(stream != null);
stream.WriteLine();