Skip to content

Commit 718e903

Browse files
committed
Merge branch 'topic/VC20-026' into 'master'
Topic/vc20 026 See merge request eng/ide/gnatdoc!32
2 parents 5070eb3 + 85fbe5f commit 718e903

File tree

4 files changed

+72
-15
lines changed

4 files changed

+72
-15
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ check_extractor:
1515
(cd testsuite/extractor && ../../.objs/test_extractor gnat.json overriding_indicator.ads | diff -u --strip-trailing-cr overriding_indicator.out -)
1616
(cd testsuite/extractor && ../../.objs/test_extractor pattern.json documentation_pattern.ads | diff -u --strip-trailing-cr documentation_pattern.out -)
1717
(cd testsuite/extractor && ../../.objs/test_extractor gnat.json exceptions.ads | diff -u --strip-trailing-cr exceptions.out -)
18-
(cd testsuite/extractor && ../../.objs/test_extractor gnat.json records.ads | diff -u --strip-trailing-cr records.out -)
18+
(cd testsuite/extractor && ../../.objs/test_extractor gnat.json records.ads | diff -u --strip-trailing-cr records.ads.out -)
1919
(cd testsuite/extractor && ../../.objs/test_extractor gnat.json tasks.ads | diff -u --strip-trailing-cr tasks.out -)
2020
(cd testsuite/extractor && ../../.objs/test_extractor gnat.json protecteds.ads | diff -u --strip-trailing-cr protecteds.ads.out -)
2121
(cd testsuite/extractor && ../../.objs/test_extractor gnat.json protecteds.adb | diff -u --strip-trailing-cr protecteds.adb.out -)

source/gnatdoc-comments-builders-records.adb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,17 @@ package body GNATdoc.Comments.Builders.Records is
6060
when Ada_Ada_Node_List | Ada_Variant_List =>
6161
return Into;
6262

63-
when Ada_Alternatives_List | Ada_Others_Designator =>
64-
return Into;
63+
when Ada_Alternatives_List =>
64+
return Over;
65+
66+
when Ada_Identifier =>
67+
-- Discriminant name in the variant part
68+
69+
return Over;
70+
71+
when Ada_Null_Component_Decl =>
72+
-- null component is not included into documentation
6573

66-
when Ada_Null_Component_Decl | Ada_Identifier | Ada_Dotted_Name
67-
| Ada_Int_Literal
68-
=>
6974
return Over;
7075

7176
when Ada_Known_Discriminant_Part | Ada_Discriminant_Spec_List =>
@@ -90,7 +95,7 @@ package body GNATdoc.Comments.Builders.Records is
9095
return Over;
9196

9297
when others =>
93-
Put_Line (Image (Node));
98+
Put_Line (Standard_Error, Image (Node));
9499

95100
raise Program_Error with Ada_Node_Kind_Type'Image (Node.Kind);
96101
end case;

testsuite/extractor/records.ads

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,25 @@ package Records is
100100
end record;
101101
-- Comments for both fields must be extracted from the comments around.
102102

103+
--------------
104+
-- VC20-026 --
105+
--------------
106+
107+
type Foo_1 (X : Integer) is record
108+
case X is
109+
when -6 =>
110+
A : Integer;
111+
when -5 | -4 =>
112+
B : Integer;
113+
when -3 .. -1 =>
114+
C : Integer;
115+
when Natural =>
116+
D : Integer;
117+
when others =>
118+
E : Integer;
119+
end case;
120+
end record;
121+
-- This is example of the record type with discriminant of integer type and
122+
-- variant part that depends from few kind of values.
123+
103124
end Records;

testsuite/extractor/records.out renamed to testsuite/extractor/records.ads.out

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<CompilationUnit records.ads:2:1-103:13>
1+
<CompilationUnit records.ads:2:1-124:13>
22
<AdaNodeList records.ads:2:1-4:23>
33
<WithClause records.ads:2:1-2:30>
44
<LimitedAbsent records.ads:2:1-2:1>
@@ -12,18 +12,18 @@
1212
<PrivateAbsent records.ads:2:30-2:30>
1313
<NameList records.ads:4:6-4:22>
1414
<Id "All_Enumerations" records.ads:4:6-4:22>
15-
<LibraryItem records.ads:6:1-103:13>
15+
<LibraryItem records.ads:6:1-124:13>
1616
<PrivateAbsent records.ads:4:23-4:23>
17-
<PackageDecl ["Records"] records.ads:6:1-103:13>
17+
<PackageDecl ["Records"] records.ads:6:1-124:13>
1818
**************************
1919
\/ RAW <<HEADER>> () 0 0 0 0
2020
\/ RAW <<INTERMEDIATE UPPER>> () 0 0 0 0
2121
\/ DESCRIPTION () 0 0 0 0
2222
**************************
2323
<DefiningName records.ads:6:9-6:16>
2424
<Id "Records" records.ads:6:9-6:16>
25-
<PublicPart records.ads:6:19-103:1>
26-
<AdaNodeList records.ads:8:4-100:15>
25+
<PublicPart records.ads:6:19-124:1>
26+
<AdaNodeList records.ads:8:4-120:15>
2727
<ConcreteTypeDecl ["Record_Type_1"] records.ads:8:4-10:15>
2828
**************************
2929
\/ FIELD a (A) 8 8 9 8
@@ -183,6 +183,37 @@ end record;
183183
\/ DESCRIPTION () 0 0 0 0
184184
Comments for both fields must be extracted from the comments around.
185185
**************************
186-
<EndName records.ads:103:5-103:12>
187-
<Id "Records" records.ads:103:5-103:12>
188-
<PragmaNodeList records.ads:103:13-103:13>
186+
<ConcreteTypeDecl ["Foo_1"] records.ads:107:4-120:15>
187+
**************************
188+
\/ FIELD x (X) 107 107 108 107
189+
\/ FIELD a (A) 110 110 111 110
190+
\/ FIELD b (B) 112 112 113 112
191+
\/ FIELD c (C) 114 114 115 114
192+
\/ FIELD d (D) 116 116 117 116
193+
\/ FIELD e (E) 118 118 119 119
194+
\/ RAW <<LEADING>> () 0 0 0 0
195+
\/ RAW <<TRAILING>> () 0 0 0 0
196+
This is example of the record type with discriminant of integer type and
197+
variant part that depends from few kind of values.
198+
\/ SNIPPET ada () 0 0 0 0
199+
type Foo_1 (X : Integer) is record
200+
case X is
201+
when -6 =>
202+
A : Integer;
203+
when -5 | -4 =>
204+
B : Integer;
205+
when -3 .. -1 =>
206+
C : Integer;
207+
when Natural =>
208+
D : Integer;
209+
when others =>
210+
E : Integer;
211+
end case;
212+
end record;
213+
\/ DESCRIPTION () 0 0 0 0
214+
This is example of the record type with discriminant of integer type and
215+
variant part that depends from few kind of values.
216+
**************************
217+
<EndName records.ads:124:5-124:12>
218+
<Id "Records" records.ads:124:5-124:12>
219+
<PragmaNodeList records.ads:124:13-124:13>

0 commit comments

Comments
 (0)