From 9897cb74c1f9e7139b9a1d890aca4168cfd95326 Mon Sep 17 00:00:00 2001 From: akashlal Date: Thu, 25 Sep 2014 10:19:52 +0530 Subject: Lets have a setter for TopLevelDeclarations as well --- Source/Core/Absy.cs | 22 ++++++++++++++++++---- Source/Houdini/AbstractHoudini.cs | 3 +-- Source/VCGeneration/StratifiedVC.cs | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Source/Core/Absy.cs b/Source/Core/Absy.cs index 30333259..d5abda9b 100644 --- a/Source/Core/Absy.cs +++ b/Source/Core/Absy.cs @@ -446,10 +446,16 @@ namespace Microsoft.Boogie { public IEnumerable TopLevelDeclarations { - get - { - return topLevelDeclarations; - } + get + { + return topLevelDeclarations; + } + + set + { + ClearTopLevelDeclarations(); + AddTopLevelDeclarations(value); + } } public void AddTopLevelDeclaration(Declaration decl) @@ -468,6 +474,14 @@ namespace Microsoft.Boogie { this.globalVariablesCache = null; } + public void RemoveTopLevelDeclaration(Declaration decl) + { + Contract.Requires(!TopLevelDeclarationsAreFrozen); + + topLevelDeclarations.Remove(decl); + this.globalVariablesCache = null; + } + public void RemoveTopLevelDeclarations(Predicate match) { Contract.Requires(!TopLevelDeclarationsAreFrozen); diff --git a/Source/Houdini/AbstractHoudini.cs b/Source/Houdini/AbstractHoudini.cs index 6920ade3..cc8298b3 100644 --- a/Source/Houdini/AbstractHoudini.cs +++ b/Source/Houdini/AbstractHoudini.cs @@ -2401,8 +2401,7 @@ namespace Microsoft.Boogie.Houdini { var decls = new List(copy.Values); decls.AddRange(program.TopLevelDeclarations.Where(decl => !(decl is Implementation))); - program.ClearTopLevelDeclarations(); - program.AddTopLevelDeclarations(decls); + program.TopLevelDeclarations = decls; var name2Proc = new Dictionary(); foreach (var proc in program.Procedures) { diff --git a/Source/VCGeneration/StratifiedVC.cs b/Source/VCGeneration/StratifiedVC.cs index e8194891..5d01f2c1 100644 --- a/Source/VCGeneration/StratifiedVC.cs +++ b/Source/VCGeneration/StratifiedVC.cs @@ -2144,7 +2144,7 @@ namespace VC { protected override HashSet CombineResults(List> results, bool arg) { var ret = new HashSet(); - results.ForEach(s => ret.UnionWith(s)); + results.Iter(s => ret.UnionWith(s)); return ret; } } -- cgit v1.2.3