@@ -17,9 +17,8 @@ public class CoverageAnnotator : StandardVisitor
1717 private Dictionary < string , ISet < string > > implementationGoalIds = new ( ) ;
1818 private Dictionary < string , Absy > idMap = new ( ) ;
1919
20- private void addImplementationGoalId ( string id )
20+ private void AddImplementationGoalId ( string id )
2121 {
22- implementationGoalIds . TryAdd ( currentImplementation , new HashSet < string > ( ) ) ;
2322 implementationGoalIds [ currentImplementation ] . Add ( id ) ;
2423 }
2524
@@ -30,7 +29,7 @@ private void AddId(ICarriesAttributes node, bool isGoal)
3029 Absy absy = node as Absy ;
3130 idMap . Add ( idStr , absy ) ;
3231 if ( isGoal ) {
33- addImplementationGoalId ( idStr ) ;
32+ AddImplementationGoalId ( idStr ) ;
3433 }
3534 node . AddStringAttribute ( absy . tok , "id" , idStr ) ;
3635 }
@@ -53,11 +52,16 @@ private void AddId(ICarriesAttributes node, bool isGoal)
5352 public override Implementation VisitImplementation ( Implementation node )
5453 {
5554 currentImplementation = node . Name ;
55+ implementationGoalIds . TryAdd ( currentImplementation , new HashSet < string > ( ) ) ;
5656 return base . VisitImplementation ( node ) ;
5757 }
5858
5959 public override Cmd VisitAssertCmd ( AssertCmd node )
6060 {
61+ if ( node . Expr is LiteralExpr { IsTrue : true } ) {
62+ return node ;
63+ }
64+
6165 AddId ( node , true ) ;
6266 return base . VisitAssertCmd ( node ) ;
6367 }
@@ -82,6 +86,10 @@ public override Requires VisitRequires(Requires requires)
8286
8387 public override Ensures VisitEnsures ( Ensures ensures )
8488 {
89+ if ( ensures . Free ) {
90+ return ensures ;
91+ }
92+
8593 AddId ( ensures , true ) ;
8694 return base . VisitEnsures ( ensures ) ;
8795 }
0 commit comments