-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
Unparsing: Fix ConcreteTypeDecl, ProtectedTypeDecl and TaskTypeDecl Closes eng/ide/gnatformat#52 See merge request eng/libadalang/libadalang!1717
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
array (Buffer_Index) | ||
of Veeeeeeeeeeeeeeery_Looooooooooooonnnnnnnnnnnng_Element_Type | ||
of Veeeeeeeeeeeeeeery_Looooooooooooonnnnnnnnnnnng_Element_Type |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
description: | | ||
This test checks the formatting of an anonymous array type declaration. | ||
It is expected the declaration breaks before `of` keywords and the new | ||
line be indented. | ||
line to have the same indentation as the `array` keyword. | ||
driver: unparser | ||
rule: anonymous_type_decl |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
array (Veeeeeeeerrrrrrry_Loooooooooooooooooooooooooooooong_Buffer_Indexxxxxxxx) | ||
of Character | ||
of Character |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
array (Buffer_Index_1, Buffer_Index_2, Buffer_Index_3, Buffer_Index_4, Buffer_Index_5) of Character.Long_Dotted_Name.Long_Dotted_Name.Long_Dotted_Name.Long_Dotted_Name |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
array (Buffer_Index_1, | ||
Buffer_Index_2, | ||
Buffer_Index_3, | ||
Buffer_Index_4, | ||
Buffer_Index_5) | ||
of Character | ||
.Long_Dotted_Name | ||
.Long_Dotted_Name | ||
.Long_Dotted_Name | ||
.Long_Dotted_Name |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
description: | | ||
This test checks the formatting of an anonymous array type declaration with | ||
multiple indices. | ||
It is expected the declaration breaks before `of` keywords and the new | ||
line to have the same indentation as the `array` keyword. | ||
Is is also expected that the indices have continuation line indentation | ||
relative to where the `array` keyword ends. | ||
driver: unparser | ||
rule: anonymous_type_decl |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
description: | | ||
This test checks the formatting of an anonymous array type declaration. | ||
It is expected the declaration stays on a single line. | ||
driver: unparser | ||
rule: anonymous_type_decl |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
task type Server | ||
is | ||
task type Server is | ||
entry Next_Work_Item (WI : in Work_Item); | ||
entry Shut_Down; | ||
end Server; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
task type Worker(Priority_Level : System.Priority; Buffer_Parameter : access Buffer) | ||
with Priority => Prio is | ||
entry Fill; | ||
entry Drain; | ||
end Worker; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
task type Worker | ||
(Priority_Level : System.Priority; | ||
Buffer_Parameter : access Buffer) | ||
with Priority => Prio | ||
is | ||
entry Fill; | ||
entry Drain; | ||
end Worker; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
description: | | ||
This test checks the formatting of a protected type declaration | ||
with known discriminant, aspects and public. | ||
It is expected the declaration breaks before the discriminant | ||
specification, before `with` and `is` keywords and be formatted | ||
by indenting the discriminant specification, the aspects and the | ||
public part content and keeping the `protected`, `is` and `end` | ||
keywords aligned. | ||
driver: unparser | ||
rule: task_type_decl |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
task type Keyboard_Driver(ID : Keyboard_ID := New_ID) is | ||
new Serial_Device with | ||
task type Keyboard_Driver (ID : Keyboard_ID := New_ID) is new Serial_Device with | ||
entry Read (C : out Character); | ||
entry Write(C : in Character); | ||
end Keyboard_Driver; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
procedure Find_Matching_Parents | ||
(Match_1 : access protected function (Node : Libadalang.Analysis.Ada_Node'Class) return Boolean; | ||
Match_2 : not null access protected function (Node : Libadalang.Analysis.Ada_Node'Class) return Boolean); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
procedure Find_Matching_Parents | ||
(Match_1 : | ||
access protected function | ||
(Node : Libadalang.Analysis.Ada_Node'Class) return Boolean; | ||
Match_2 : | ||
not null access protected function | ||
(Node : Libadalang.Analysis.Ada_Node'Class) return Boolean); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
driver: unparser | ||
rule: subp_decl | ||
description: | | ||
Test that `f_has_not_null`, `f_has_protected` and `f_subp_spec` do not have | ||
line breaks between them. Also test that `f_subp_spec` has its parameters | ||
correctly indented. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
type Derived_Interface is new Int1 and Int2 with null record; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type Painted_Point is new Poooooooooooooiiiiiiiiiint1 with record | ||
Paint : Color := White; | ||
end record; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
type Painted_Point | ||
(Foo : Fooooooooooooooo := Foo_Bar; | ||
Baar : Baaaaaaaaaar; | ||
Baaaz : Baaaaaaaaaaaaaaz := Baz_Baz) | ||
is abstract limited new Poooooooooooooiiiiiiiiiint1 | ||
and Poooooooooooooooooiiiiint2 | ||
and Point3 | ||
with record | ||
Paint_1 : Color := White; | ||
Paint_222 : Color_X := White; | ||
end record; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
type Painted_Point | ||
(Foo : Fooooooooooooooo := Foo_Bar; | ||
Baar : Baaaaaaaaaar; | ||
Baaaz : Baaaaaaaaaaaaaaz := Baz_Baz) | ||
is abstract limited | ||
new Poooooooooooooiiiiiiiiiint1 | ||
and Poooooooooooooooooiiiiint2 | ||
and Point3 | ||
with record | ||
Paint_1 : Color := White; | ||
Paint_222 : Color_X := White; | ||
end record; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
driver: unparser | ||
rule: type_decl | ||
description: | | ||
This test checks the formatting of a derived type declaration with | ||
non empty interface list, non empty discriminats and record extension. | ||
It is expected the declaration breaks after `is abstract limited` and | ||
`before `with record`. | ||
The interface list be splitted in multiple lines and continuation line | ||
indented. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type Painted_Point is | ||
new Poooooooooooooiiiiiiiiiint1 | ||
and Poooooooooooooooooiiiiint2 | ||
and Point3 | ||
with record | ||
Paint : Color := White; | ||
end record; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
type Foo is new Bar and Baz and Corge and Garply and Fred and Fnoord with record A : B; end record; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
type Foo is new Bar and Baz and Corge and Garply and Fred and Fnoord | ||
with record | ||
A : B; | ||
end record; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
description: | | ||
This test checks the formatting of a simple derived type declaration. | ||
It is expected the declaration stays on a single line. | ||
driver: unparser | ||
rule: type_decl |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
type Base_Type is interface and Interface_1 and Interface_2; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
type Combo_Sync_Interface is | ||
synchronized interface | ||
and My_Interface_1 | ||
and My_Interface_2 | ||
and My_Interface_3 | ||
and My_Interface_4; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
type Combo_Sync_Interface is | ||
synchronized interface | ||
and My_Interface_1 | ||
and My_Interface_2 | ||
and My_Interface_3 | ||
and My_Interface_4; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
type Combo_Sync_Interface is | ||
synchronized interface and My_Interface_1 and My_Interface_2; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
description: | | ||
This test checks the formatting of a synchronized interface | ||
type declaration with not empty interface list. | ||
It is expected the declaration break after `is` keyword and | ||
all the interface list elements and be indented relative to | ||
the type keyword with a line continuation indentation. | ||
driver: unparser | ||
rule: type_decl |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
type Decimal_Fixed_Point_Type_Decl_Looooooooooooooooong is delta 0.01 digits 15; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
type Decimal_Fixed_Point_Type_Decl_Looooooooooooooooong is | ||
delta 0.01 digits 15; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
description: | | ||
This test checks the formatting of a simple decimal fixed point type | ||
declaration. It is expected the declaration be splitted in two | ||
lines after the is keyword and the new line be indented with a | ||
line continuation indentation (i.e., 2 spaces) stays on the same line. | ||
|
||
driver: unparser | ||
rule: type_decl |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
type Fooooooooooooooo (Baaaaaaaar : Baaaaaaaaaaz := Baaar_Bazzz) is | ||
abstract tagged limited record | ||
Day : Integer range 1 .. 31; | ||
Month : Month_Enum; | ||
Year : Integer range 0 .. 4000; | ||
end record; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
type Fooooooooooooooo (Baaaaaaaar : Baaaaaaaaaaz := Baaar_Bazzz) is | ||
abstract tagged limited record | ||
Day : Integer range 1 .. 31; | ||
Month : Month_Enum; | ||
Year : Integer range 0 .. 4000; | ||
end record; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
driver: unparser | ||
rule: type_decl | ||
description: | | ||
This test checks that `f_discriminants` are kept on the same line and | ||
"`f_has_abstract` `f_has_tagged` `f_has_limited` `f_record_def`" are on a | ||
seprate line. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
type Fooooooooooooooo | ||
(Baaaaaaaar : Baaaaaaaaaaz := Baaar_Bazzz; | ||
Garply : Corge := Garply_Corge) | ||
is abstract tagged limited record | ||
Day : Integer range 1 .. 31; | ||
Month : Month_Enum; | ||
Year : Integer range 0 .. 4000; | ||
end record; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
type Fooooooooooooooo | ||
(Baaaaaaaar : Baaaaaaaaaaz := Baaar_Bazzz; | ||
Garply : Corge := Garply_Corge) | ||
is abstract tagged limited record | ||
Day : Integer range 1 .. 31; | ||
Month : Month_Enum; | ||
Year : Integer range 0 .. 4000; | ||
end record; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
driver: unparser | ||
rule: type_decl | ||
description: | ||
This test checks that long `f_discriminants` are formatted in multiple lines. | ||
It also checks that `is` is in its own line followed by | ||
"`f_has_abstract` `f_has_tagged` `f_has_limited` `f_record_def`". |