Skip to content

Commit 94ad744

Browse files
committed
make examples compile
1 parent 42084c3 commit 94ad744

File tree

6 files changed

+56
-33
lines changed

6 files changed

+56
-33
lines changed

doc/Type/Backtrace.pod6

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ example routines like C<&die> are hidden by default.
2020
Defined as:
2121
2222
=begin code :skip-test
23-
proto method new(*@, *%) {*}
23+
proto method new(*@, *%) {*}
24+
multi method new()
2425
=end code
25-
multi method new()
2626
2727
Usage:
2828
@@ -39,7 +39,6 @@ Defined as:
3939
4040
Usage:
4141
42-
4342
my $backtrace = Backtrace.new;
4443
say $backtrace.Str;
4544

doc/Type/Backtrace/Frame.pod6

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ Defined as:
1818
1919
Usage:
2020
21-
FRAME.file
21+
my $bt = Backtrace.new;
22+
my $btf = $bt[0];
23+
say $btf.file;
2224
2325
Returns the file name.
2426
@@ -30,7 +32,9 @@ Defined as:
3032
3133
Usage:
3234
33-
FRAME.line
35+
my $bt = Backtrace.new;
36+
my $btf = $bt[0];
37+
say $btf.line;
3438
3539
Returns the line number (line numbers start to count from 1).
3640
@@ -42,7 +46,9 @@ Defined as:
4246
4347
Usage:
4448
45-
FRAME.code
49+
my $bt = Backtrace.new;
50+
my $btf = $bt[0];
51+
say $btf.code;
4652
4753
Returns the code object into which C<.file> and C<.line> point, if available.
4854
@@ -54,19 +60,23 @@ Defined as:
5460
5561
Usage:
5662
57-
FRAME.subname
63+
my $bt = Backtrace.new;
64+
my $btf = $bt[0];
65+
say $btf.subname;
5866
5967
Returns the name of the enclosing subroutine.
6068
6169
=head2 method is-hidden
6270
6371
Defined as:
6472
65-
method is-hidden(Backtrace::Frame:D) return Bool:D
73+
method is-hidden(Backtrace::Frame:D) returns Bool:D
6674
6775
Usage:
6876
69-
FRAME.is-hidden
77+
my $bt = Backtrace.new;
78+
my $btf = $bt[0];
79+
say $btf.is-hidden;
7080
7181
Returns C<True> if the frame is marked as hidden with the
7282
C<is hidden-from-backtrace> trait.
@@ -75,11 +85,13 @@ C<is hidden-from-backtrace> trait.
7585
7686
Defined as:
7787
78-
method is-routine(Backtrace::Frame:D) return Bool:D
88+
method is-routine(Backtrace::Frame:D) returns Bool:D
7989
8090
Usage:
8191
82-
FRAME.is-routine
92+
my $bt = Backtrace.new;
93+
my $btf = $bt[0];
94+
say $btf.is-routine;
8395
8496
Return C<True> if the frame point into a routine (and not
8597
into a mere L<Block>).
@@ -88,11 +100,13 @@ into a mere L<Block>).
88100
89101
Defined as:
90102
91-
method is-setting(Backtrace::Frame:D) return Bool:D
103+
method is-setting(Backtrace::Frame:D) returns Bool:D
92104
93105
Usage:
94106
95-
FRAME.is-setting
107+
my $bt = Backtrace.new;
108+
my $btf = $bt[0];
109+
say $btf.is-setting; # True
96110
97111
Returns C<True> if the frame is part of a setting.
98112

doc/Type/Metamodel/MROBasedMethodDispatch.pod6

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ If C<:no_fallback> is supplied, fallback methods are not considered.
2828
Given a method name and a type, returns the method from that type. This is
2929
used in calls like
3030
31-
self.SomeParentClass::the_method();
31+
=for code :skip-test
32+
self.SomeParentClass::the_method();
3233
3334
=begin comment
3435

doc/Type/Metamodel/Primitives.pod6

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
55
=SUBTITLE Metaobject that supports low-level type operations
66
7-
class Metamodel::Primitives is SuperClass {}
7+
=begin code :skip-test
8+
class Metamodel::Primitives is SuperClass {}
9+
=end code
810
911
C<Metamodel::Primitives> provides low-level operations for working with types,
1012
which are otherwise only available as implementation-dependent directives.
@@ -21,7 +23,9 @@ of just one method called C<why>:
2123
my %methods = why => sub ($) { say 42 };
2224
Metamodel::Primitives.install_method_cache($type, %methods, :authoritative);
2325
$type.why; # 42
24-
$type.list; # No such method 'list' for invocant of type 'why oh why?'
26+
$type.list;
27+
CATCH { default { put .^name, ': ', .Str } };
28+
# OUTPUT: «X::Method::NotFound: Method 'list' not found for invocant of class 'why oh why?'␤»
2529
2630
=head1 Methods
2731
@@ -50,12 +54,13 @@ to C<False>, the usual fallback mechanism are tried.
5054
5155
=head2 method configure_type_checking
5256
53-
method configure_type_checking(
54-
Mu $type,
55-
@cache,
56-
:$authoritative = True,
57-
:$call_accepts = False
58-
)
57+
=for code :skip-test
58+
method configure_type_checking(
59+
Mu $type,
60+
@cache,
61+
:$authoritative = True,
62+
:$call_accepts = False
63+
)
5964
6065
Configures the type checking for C<$type>. C<@cache> is a list of known types
6166
against which C<$type> checks positively (so in a classical class-based

doc/Type/Metamodel/RoleContainer.pod6

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
99
Implements the ability to hold roles to be held for composition.
1010
11-
class A does SomeRole {}
11+
=for code :skip-test
12+
class A does SomeRole {}
1213
1314
roughly corresponds to
1415
15-
class A {
16-
BEGIN A.^add_role(SomeRole);
17-
}
16+
=for code :skip-test
17+
class A {
18+
BEGIN A.^add_role(SomeRole);
19+
}
1820
1921
=head1 Methods
2022

doc/Type/Metamodel/Trusting.pod6

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
55
=SUBTITLE Metaobject that supports trust relations between types
66
7-
role Metamodel::Trusting is SuperClass { ... }
7+
=for code :skip-test
8+
role Metamodel::Trusting is SuperClass { ... }
89
910
Normally, code in a class or role can only access its own private methods. If
1011
another type declares that it trusts that first class, then access to private
@@ -23,9 +24,9 @@ that aspect of the Perl 6 object system.
2324
# disallowed if A doesn't trust B
2425
B.new()!B::private_method();
2526
}
26-
}
27+
};
2728
28-
A.build-and-poke # Private method in A
29+
A.build-and-poke; # Private method in A
2930
3031
=head1 Methods
3132
@@ -35,10 +36,11 @@ that aspect of the Perl 6 object system.
3536
3637
Trust C<$trustee>.
3738
38-
class A {
39-
BEGIN A.^add_trustee(B);
40-
# same as 'trusts B';
41-
}
39+
=for code :skip-test
40+
class A {
41+
BEGIN A.^add_trustee(B);
42+
# same as 'trusts B';
43+
}
4244
4345
=head2 method trusts
4446

0 commit comments

Comments
 (0)