@@ -246,13 +246,20 @@ package SC_Obligations is
246
246
-- Is_Active to know whether a given scope is active in the given
247
247
-- traversal.
248
248
249
- function Scope_Traversal (CU : CU_Id) return Scope_Traversal_Type;
249
+ function Scope_Traversal (CU : CU_Id) return Scope_Traversal_Type
250
+ with Post => Last_SCO (Scope_Traversal'Result) = No_SCO_Id;
250
251
-- Return a scope traversal for the given compilation unit
251
252
252
- procedure Traverse_SCO (ST : in out Scope_Traversal_Type; SCO : SCO_Id);
253
+ procedure Traverse_SCO (ST : in out Scope_Traversal_Type; SCO : SCO_Id)
254
+ with Pre => Last_SCO (ST) <= SCO,
255
+ Post => Last_SCO (ST) = SCO;
253
256
-- Traverse the given SCO and update the Scope_Traversal accordingly. Note
254
257
-- that the scope traversal must be done on increasing SCOs identifiers.
255
258
259
+ function Last_SCO (ST : Scope_Traversal_Type) return SCO_Id;
260
+ -- Return the last SCO that was passed to Traverse_SCO, or No_SCO_Id if
261
+ -- Traverse_SCO has not been called yet on ST.
262
+
256
263
function Is_Active
257
264
(ST : Scope_Traversal_Type;
258
265
Subps_Of_Interest : Scope_Id_Set) return Boolean;
@@ -1376,6 +1383,11 @@ private
1376
1383
1377
1384
It : Iterator_Acc;
1378
1385
-- Iterator to traverse the scope tree
1386
+
1387
+ Last_SCO : SCO_Id;
1388
+ -- Keep track of the last SCO requested with Traverse_SCO. We use this
1389
+ -- to check that SCOs are requested in the right order (lower Ids to
1390
+ -- higher ones).
1379
1391
end record ;
1380
1392
1381
1393
procedure Set_Active_Scope_Ent
@@ -1389,6 +1401,7 @@ private
1389
1401
Active_Scopes => Scope_Id_Sets.Empty_Set,
1390
1402
Active_Scope_Ent => Scope_Entities_Trees.No_Element,
1391
1403
Next_Scope_Ent => Scope_Entities_Trees.No_Element,
1392
- It => null );
1404
+ It => null ,
1405
+ Last_SCO => No_SCO_Id);
1393
1406
1394
1407
end SC_Obligations ;
0 commit comments