Skip to content

Commit 197d042

Browse files
committed
Include any routines from superclasses/roles
Previously only methods were added. This fails to include those methods that are under a "routine" heading. Also, we shouldn't assume that users of a class are only interested in inherited/supplied methods; subs, traits and operators from a super type are equally interesting to users of a subclass.
1 parent e721247 commit 197d042

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

htmlify.p6

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use Pod::Htmlify;
3232
my $*DEBUG = False;
3333

3434
my $type-graph;
35-
my %methods-by-type;
35+
my %routines-by-type;
3636
my %*POD2HTML-CALLBACKS;
3737

3838
# TODO: Generate menulist automatically
@@ -263,32 +263,32 @@ multi write-type-source($doc) {
263263
my @roles-todo = $type.roles;
264264
my %roles-seen;
265265
while @roles-todo.shift -> $role {
266-
next unless %methods-by-type{$role};
266+
next unless %routines-by-type{$role};
267267
next if %roles-seen{$role}++;
268268
@roles-todo.push: $role.roles;
269269
$pod.contents.push:
270-
pod-heading("Methods supplied by role $role"),
270+
pod-heading("Routines supplied by role $role"),
271271
pod-block(
272272
"$podname does role ",
273273
pod-link($role.name, "/type/{uri_escape ~$role}"),
274274
", which provides the following methods:",
275275
),
276-
%methods-by-type{$role}.list,
276+
%routines-by-type{$role}.list,
277277
;
278278
}
279279
for @mro -> $class {
280-
next unless %methods-by-type{$class};
280+
next unless %routines-by-type{$class};
281281
$pod.contents.push:
282-
pod-heading("Methods supplied by class $class"),
282+
pod-heading("Routines supplied by class $class"),
283283
pod-block(
284284
"$podname inherits from class ",
285285
pod-link($class.name, "/type/{uri_escape ~$class}"),
286286
", which provides the following methods:",
287287
),
288-
%methods-by-type{$class}.list,
288+
%routines-by-type{$class}.list,
289289
;
290290
for $class.roles -> $role {
291-
next unless %methods-by-type{$role};
291+
next unless %routines-by-type{$role};
292292
$pod.contents.push:
293293
pod-heading("Methods supplied by role $role"),
294294
pod-block(
@@ -298,7 +298,7 @@ multi write-type-source($doc) {
298298
pod-link($role.name, "/type/{uri_escape ~$role}"),
299299
", which provides the following methods:",
300300
),
301-
%methods-by-type{$role}.list,
301+
%routines-by-type{$role}.list,
302302
;
303303
}
304304
}
@@ -444,8 +444,8 @@ sub find-definitions (:$pod, :$origin, :$min-level = -1) {
444444
$created.subkinds = @subkinds;
445445
$created.categories = @subkinds;
446446
}
447-
if $subkinds 'method' {
448-
%methods-by-type{$origin.name}.push: $chunk;
447+
if %attr<kind> eq 'routine' {
448+
%routines-by-type{$origin.name}.push: $chunk;
449449
write-qualified-method-call(
450450
:$name,
451451
:pod($chunk),
@@ -698,6 +698,7 @@ sub write-qualified-method-call(:$name!, :$pod!, :$type!) {
698698
pod-block('From ', pod-link($type, "/type/{$type}#$name")),
699699
@$pod,
700700
);
701+
return if $name ~~ / '/' /;
701702
spurt "html/routine/{$type}.{$name}.html", p2h($p, 'routine');
702703
}
703704

0 commit comments

Comments
 (0)