public static void Transform(LinearTypeChecker linearTypeChecker, MoverTypeChecker moverTypeChecker) { List <Declaration> originalDecls = new List <Declaration>(); Program program = linearTypeChecker.program; foreach (var decl in program.TopLevelDeclarations) { Procedure proc = decl as Procedure; if (proc != null && moverTypeChecker.procToActionInfo.ContainsKey(proc)) { originalDecls.Add(proc); continue; } Implementation impl = decl as Implementation; if (impl != null && moverTypeChecker.procToActionInfo.ContainsKey(impl.Proc)) { originalDecls.Add(impl); } } List <Declaration> decls = new List <Declaration>(); if (!CommandLineOptions.Clo.TrustAtomicityTypes) { MoverCheck.AddCheckers(linearTypeChecker, moverTypeChecker, decls); } OwickiGries.AddCheckers(linearTypeChecker, moverTypeChecker, decls); foreach (Declaration decl in decls) { decl.Attributes = OwickiGries.RemoveYieldsAttribute(decl.Attributes); } program.RemoveTopLevelDeclarations(x => originalDecls.Contains(x)); program.AddTopLevelDeclarations(decls); }
public static void Transform(LinearTypeChecker linearTypeChecker, MoverTypeChecker moverTypeChecker) { // The order in which originalDecls are computed and then *.AddCheckers are called is // apparently important. The MyDuplicator code currently does not duplicate Attributes. // Consequently, all the yield attributes are eliminated by the AddCheckers code. List <Declaration> originalDecls = new List <Declaration>(); Program program = linearTypeChecker.program; foreach (var decl in program.TopLevelDeclarations) { Procedure proc = decl as Procedure; if (proc != null && QKeyValue.FindBoolAttribute(proc.Attributes, "yields")) { originalDecls.Add(proc); continue; } Implementation impl = decl as Implementation; if (impl != null && QKeyValue.FindBoolAttribute(impl.Proc.Attributes, "yields")) { originalDecls.Add(impl); } } List <Declaration> decls = new List <Declaration>(); OwickiGries.AddCheckers(linearTypeChecker, moverTypeChecker, decls); MoverCheck.AddCheckers(linearTypeChecker, moverTypeChecker, decls); RefinementCheck.AddCheckers(linearTypeChecker, moverTypeChecker, decls); program.TopLevelDeclarations.RemoveAll(x => originalDecls.Contains(x)); program.TopLevelDeclarations.AddRange(decls); }
public MoverTypeChecker(Program program) { this.qedGlobalVariables = new HashSet <Variable>(); foreach (var g in program.GlobalVariables()) { if (QKeyValue.FindBoolAttribute(g.Attributes, "qed")) { this.qedGlobalVariables.Add(g); g.Attributes = OwickiGries.RemoveQedAttribute(g.Attributes); } } this.procToActionInfo = new Dictionary <Procedure, ActionInfo>(); this.assertionPhaseNums = new HashSet <int>(); this.errorCount = 0; this.checkingContext = new CheckingContext(null); this.program = program; this.enclosingProcPhaseNum = int.MaxValue; this.inAtomicSpecification = false; }