Natools

Check-in [7ac5ffc727]
Login
Overview
Comment:s_expressions-generic_caches: fix level compuation of lists that have just been opened
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7ac5ffc727feba8b641c4ae209df66b307b0d861
User & Date: nat on 2014-02-22 13:46:50
Other Links: manifest | tags
Context
2014-02-23
17:55
s_expressions-generic_caches: turn a useless check into a precondition check-in: f06c3f6401 user: nat tags: trunk
2014-02-22
13:46
s_expressions-generic_caches: fix level compuation of lists that have just been opened check-in: 7ac5ffc727 user: nat tags: trunk
2014-02-21
19:39
s_expressions-test_tools: new test for Descriptor interface of caches check-in: 6608672b76 user: nat tags: trunk
Changes

Modified src/natools-s_expressions-generic_caches.adb from [4410166561] to [9263dcc4c7].

265
266
267
268
269
270
271







272
273
274
275
276
277
278
   end Current_Atom;


   overriding function Current_Level (Object : in Cursor) return Natural is
      Result : Natural := 0;
      N : Node_Access := Object.Position;
   begin







      while N /= null loop
         Result := Result + 1;
         N := N.Parent;
      end loop;

      return Natural'Max (Result, 1) - 1;
   end Current_Level;







>
>
>
>
>
>
>







265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
   end Current_Atom;


   overriding function Current_Level (Object : in Cursor) return Natural is
      Result : Natural := 0;
      N : Node_Access := Object.Position;
   begin
      if Object.Position /= null
        and then Object.Position.Kind = List_Node
        and then Object.Opening
      then
         Result := Result + 1;
      end if;

      while N /= null loop
         Result := Result + 1;
         N := N.Parent;
      end loop;

      return Natural'Max (Result, 1) - 1;
   end Current_Level;