diff options
author | 0biha <unknown> | 2014-12-19 13:17:21 +0100 |
---|---|---|
committer | 0biha <unknown> | 2014-12-19 13:17:21 +0100 |
commit | e58edfeb28cfff929954606203a6046d79904d9b (patch) | |
tree | 175d47202fd4589494a8bcca348d7718a7adfb9f | |
parent | fe2bc442dc600f540930f8a119722ca80f7da8e3 (diff) |
Made invariant of class 'HavocCmd' robust by changing the design (replaced public field by private field + getter/setter).
-rw-r--r-- | Source/Core/AbsyCmd.cs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/Source/Core/AbsyCmd.cs b/Source/Core/AbsyCmd.cs index 3f675317..be712ffb 100644 --- a/Source/Core/AbsyCmd.cs +++ b/Source/Core/AbsyCmd.cs @@ -3008,18 +3008,31 @@ namespace Microsoft.Boogie { }
public class HavocCmd : Cmd {
- public List<IdentifierExpr>/*!*/ Vars;
+ private List<IdentifierExpr>/*!*/ _vars;
+
+ public List<IdentifierExpr>/*!*/ Vars {
+ get {
+ Contract.Ensures(Contract.Result<List<IdentifierExpr>>() != null);
+ return this._vars;
+ }
+ set {
+ Contract.Requires(value != null);
+ this._vars = value;
+ }
+ }
+
[ContractInvariantMethod]
void ObjectInvariant() {
- Contract.Invariant(Vars != null);
+ Contract.Invariant(this._vars != null);
}
public HavocCmd(IToken/*!*/ tok, List<IdentifierExpr>/*!*/ vars)
: base(tok) {
Contract.Requires(tok != null);
Contract.Requires(vars != null);
- Vars = vars;
+ this._vars = vars;
}
+
public override void Emit(TokenTextWriter stream, int level) {
//Contract.Requires(stream != null);
stream.Write(this, level, "havoc ");
|