From f61101e3a8d286c0da202d6ca7281d2955ee2c25 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 20 Dec 2022 07:45:38 +0100 Subject: file_comments.adb: factorize code --- src/file_comments.adb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/file_comments.adb') diff --git a/src/file_comments.adb b/src/file_comments.adb index 361a67437..5fc6b4ccf 100644 --- a/src/file_comments.adb +++ b/src/file_comments.adb @@ -123,6 +123,7 @@ package body File_Comments is Line_Start : Source_Ptr) is pragma Assert (Ctxt.File /= No_Source_File_Entry); + T : File_Comments_Table renames Comments_Table.Table (Ctxt.File); N : Uns32; begin if Flag_Trace then @@ -133,8 +134,7 @@ package body File_Comments is Put (".."); Put_Uns32 (Uns32 (Last)); Put (" => "); - Put_Uns32 (Uns32 (File_Comments_Tables.Last - (Comments_Table.Table (Ctxt.File)) + 1)); + Put_Uns32 (Uns32 (File_Comments_Tables.Last (T) + 1)); Put (", state="); end if; @@ -164,8 +164,7 @@ package body File_Comments is if Line_Start = Ctxt.Line_Start then -- Yes, associate with the last node. N := Ctxt.Last_Node; - Ctxt.Next := File_Comments_Tables.Last - (Comments_Table.Table (Ctxt.File)) + 2; + Ctxt.Next := File_Comments_Tables.Last (T) + 2; -- And continue to associate. Ctxt.State := State_Line_Cont; else @@ -179,8 +178,7 @@ package body File_Comments is Put ("line_cont"); end if; N := Ctxt.Last_Node; - Ctxt.Next := File_Comments_Tables.Last - (Comments_Table.Table (Ctxt.File)) + 2; + Ctxt.Next := File_Comments_Tables.Last (T) + 2; end case; if Flag_Trace then @@ -191,8 +189,7 @@ package body File_Comments is -- Append a comment entry. File_Comments_Tables.Append - (Comments_Table.Table (Ctxt.File), - Comment_Record'(Start => Start, Last => Last, N => N)); + (T, Comment_Record'(Start => Start, Last => Last, N => N)); end Add_Comment; procedure Save_Comments (Rng : out Comments_Range) -- cgit v1.2.3