diff options
author | Dan Liew <daniel.liew@imperial.ac.uk> | 2015-01-29 09:08:14 +0000 |
---|---|---|
committer | Dan Liew <daniel.liew@imperial.ac.uk> | 2015-01-29 09:08:14 +0000 |
commit | 3eb1b720b8222b6415bed0faed12bd7b04ca5425 (patch) | |
tree | b6bbd2fbc68b0718b1ca681a8f5c12483c61b24b /Source/Core/AbsyQuant.cs | |
parent | cbeac20670125179246c253777f33aad943f8176 (diff) |
Protect the body of ForAllExpr, ExistsExpr and LambdaExpr when they
are immutable. Add unit tests to check this.
Diffstat (limited to 'Source/Core/AbsyQuant.cs')
-rw-r--r-- | Source/Core/AbsyQuant.cs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Source/Core/AbsyQuant.cs b/Source/Core/AbsyQuant.cs index 62c3f8bf..1bd16e4a 100644 --- a/Source/Core/AbsyQuant.cs +++ b/Source/Core/AbsyQuant.cs @@ -49,7 +49,19 @@ namespace Microsoft.Boogie { public List<TypeVariable>/*!*/ TypeParameters;
public List<Variable>/*!*/ Dummies;
public QKeyValue Attributes;
- public Expr/*!*/ Body;
+ // FIXME: Protect the above Fields
+ public Expr _Body;
+ public Expr/*!*/ Body {
+ get {
+ return _Body;
+ }
+ set {
+ if (Immutable)
+ throw new InvalidOperationException ("Cannot change the Body of an immutable BinderExpr");
+
+ _Body = value;
+ }
+ }
[ContractInvariantMethod]
void ObjectInvariant() {
Contract.Invariant(TypeParameters != null);
@@ -68,7 +80,7 @@ namespace Microsoft.Boogie { TypeParameters = typeParameters;
Dummies = dummies;
Attributes = kv;
- Body = body;
+ _Body = body;
if (immutable)
CachedHashCode = ComputeHashCode();
}
|