Skip to content

Commit 61493b8

Browse files
committed
Corresponding changes according to lal-refactor
For eng/ide/lal-refactor#38
1 parent d511b4f commit 61493b8

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

doc/refactoring_tools.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ Demo source is `sort_dependencies/` in [Code Samples](https://github.com/AdaCore
251251

252252
## Swap If/else statments
253253

254-
**Command name:** `als-refactor-swap_if_not`
254+
**Command name:** `als-refactor-swap_if_else`
255255

256-
* Swap If and else code branches and correct condition by adding/deleting `not`.
256+
* Swap If and else code branches and invert condition.
257257

258-
See `src/lal_refactor-swap_if_not` in [LAL Refactor repository](https://github.com/AdaCore/lal-refactor).
258+
See `src/lal_refactor-swap_if_else` in [LAL Refactor repository](https://github.com/AdaCore/lal-refactor).

source/ada/lsp-ada_driver.adb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ with LSP.Ada_Handlers.Refactor.Replace_Type;
8080
with LSP.Ada_Handlers.Refactor.Sort_Case;
8181
with LSP.Ada_Handlers.Refactor.Sort_Dependencies;
8282
with LSP.Ada_Handlers.Refactor.Suppress_Seperate;
83-
with LSP.Ada_Handlers.Refactor.Swap_If_Not;
83+
with LSP.Ada_Handlers.Refactor.Swap_If_Else;
8484
with LSP.Ada_Handlers.Show_Dependencies_Commands;
8585
with LSP.Ada_Handlers.GPR_Dependencies_Commands;
8686
with LSP.Ada_Handlers.Source_Dirs_Commands;
@@ -242,7 +242,7 @@ procedure LSP.Ada_Driver is
242242
LSP.Ada_Commands.Register
243243
(LSP.Ada_Handlers.Refactor.Sort_Dependencies.Command'Tag);
244244
LSP.Ada_Commands.Register
245-
(LSP.Ada_Handlers.Refactor.Swap_If_Not.Command'Tag);
245+
(LSP.Ada_Handlers.Refactor.Swap_If_Else.Command'Tag);
246246

247247
-- Refactoring - Change Subprogram Signature Commands
248248
LSP.Ada_Commands.Register

source/ada/lsp-ada_handlers-refactor-swap_if_not.adb renamed to source/ada/lsp-ada_handlers-refactor-swap_if_else.adb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ with Langkit_Support.Slocs; use Langkit_Support.Slocs;
2020
with Libadalang.Analysis; use Libadalang.Analysis;
2121

2222
with LAL_Refactor; use LAL_Refactor;
23-
with LAL_Refactor.Swap_If_Not;
24-
use LAL_Refactor.Swap_If_Not;
23+
with LAL_Refactor.Swap_If_Else;
24+
use LAL_Refactor.Swap_If_Else;
2525

2626
with VSS.JSON.Streams;
2727

2828
with LSP.Enumerations;
2929
with LSP.Structures.LSPAny_Vectors; use LSP.Structures.LSPAny_Vectors;
3030

31-
package body LSP.Ada_Handlers.Refactor.Swap_If_Not is
31+
package body LSP.Ada_Handlers.Refactor.Swap_If_Else is
3232

3333
pragma Warnings (Off);
3434

@@ -194,4 +194,4 @@ package body LSP.Ada_Handlers.Refactor.Swap_If_Not is
194194
return Result;
195195
end Write_Command;
196196

197-
end LSP.Ada_Handlers.Refactor.Swap_If_Not;
197+
end LSP.Ada_Handlers.Refactor.Swap_If_Else;

source/ada/lsp-ada_handlers-refactor-swap_if_not.ads renamed to source/ada/lsp-ada_handlers-refactor-swap_if_else.ads

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ with VSS.Strings;
2222
with LSP.Ada_Contexts;
2323
with LSP.Server_Jobs;
2424

25-
package LSP.Ada_Handlers.Refactor.Swap_If_Not is
25+
package LSP.Ada_Handlers.Refactor.Swap_If_Else is
2626

2727
type Command is new LSP.Ada_Handlers.Refactor.Command with private;
2828

2929
overriding function Name (Self : Command) return String
30-
is ("Swap If Not");
30+
is ("Swap If Else");
3131

3232
procedure Append_Code_Action
3333
(Self : in out Command;
@@ -69,6 +69,6 @@ private
6969
function Write_Command
7070
(Self : Command) return LSP.Structures.LSPAny_Vector;
7171

72-
for Command'External_Tag use "als-refactor-swap_if_not";
72+
for Command'External_Tag use "als-refactor-swap_if_else";
7373

74-
end LSP.Ada_Handlers.Refactor.Swap_If_Not;
74+
end LSP.Ada_Handlers.Refactor.Swap_If_Else;

source/ada/lsp-ada_handlers.adb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ with LAL_Refactor.Subprogram_Signature.Change_Parameters_Default_Value;
4949
with LAL_Refactor.Subprogram_Signature.Change_Parameters_Type;
5050
with LAL_Refactor.Subprogram_Signature.Remove_Parameter;
5151
with LAL_Refactor.Suppress_Separate;
52-
with LAL_Refactor.Swap_If_Not;
52+
with LAL_Refactor.Swap_If_Else;
5353

5454
with LSP.Ada_Completions.Aspects;
5555
with LSP.Ada_Completions.Attributes;
@@ -87,7 +87,7 @@ with LSP.Ada_Handlers.Refactor.Replace_Type;
8787
with LSP.Ada_Handlers.Refactor.Sort_Case;
8888
with LSP.Ada_Handlers.Refactor.Sort_Dependencies;
8989
with LSP.Ada_Handlers.Refactor.Suppress_Seperate;
90-
with LSP.Ada_Handlers.Refactor.Swap_If_Not;
90+
with LSP.Ada_Handlers.Refactor.Swap_If_Else;
9191
with LSP.Ada_Handlers.Renaming;
9292
with LSP.Ada_Handlers.Symbols;
9393
with LSP.Ada_Commands;
@@ -1385,15 +1385,15 @@ package body LSP.Ada_Handlers is
13851385
-----------------------------
13861386

13871387
procedure Swap_If_Not_Code_Action is
1388-
use LSP.Ada_Handlers.Refactor.Swap_If_Not;
1388+
use LSP.Ada_Handlers.Refactor.Swap_If_Else;
13891389
use Langkit_Support.Slocs;
1390-
use LAL_Refactor.Swap_If_Not;
1390+
use LAL_Refactor.Swap_If_Else;
13911391
use type LSP.Structures.Position;
13921392

13931393
Single_Location : constant Boolean :=
13941394
Value.a_range.start = Value.a_range.an_end;
13951395

1396-
Location : Source_Location :=
1396+
Location : constant Source_Location :=
13971397
(Langkit_Support.Slocs.Line_Number
13981398
(Value.a_range.start.line) + 1,
13991399
Column_Number (Value.a_range.start.character) + 1);

0 commit comments

Comments
 (0)