Skip to content

Commit 3bbea96

Browse files
authored
Merge pull request #2797 from lukasvalle/master
add .map, .flat, .concise, and .summary for Backtrace
2 parents d8b0b50 + 48bfed1 commit 3bbea96

File tree

1 file changed

+78
-1
lines changed

1 file changed

+78
-1
lines changed

doc/Type/Backtrace.pod6

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,83 @@ Defined as:
6868
6969
Returns a list of L<Backtrace::Frame> objects for this backtrace.
7070
71+
=head2 method summary
72+
73+
Defined as:
74+
75+
method summary(Backtrace:D: --> Str:D)
76+
77+
Returns a summary string representation of the backtrace, filtered
78+
by C<!.is-hidden && (.is-routine || !.is-setting)>.
79+
80+
This program:
81+
82+
sub inner { say Backtrace.new.summary }
83+
sub outer { inner; }
84+
outer;
85+
86+
results in:
87+
88+
=for code :lang<text>
89+
in method new at SETTING::src/core/Backtrace.pm6 line 85
90+
in sub inner at test.p6 line 1
91+
in sub outer at test.p6 line 2
92+
in block <unit> at test.p6 line 3
93+
94+
95+
=head2 method concise
96+
97+
Defined as:
98+
99+
method concise(Backtrace:D: --> Str:D)
100+
101+
Returns a concise string representation of the backtrace, filtered
102+
by C<!.is-hidden && .is-routine && !.is-setting>.
103+
104+
This program:
105+
106+
sub inner { say Backtrace.new.concise }
107+
sub outer { inner; }
108+
outer;
109+
110+
results in:
111+
112+
=for code :lang<text>
113+
in sub inner at test.p6 line 1
114+
in sub outer at test.p6 line 2
115+
116+
=head2 method map
117+
118+
Defined as:
119+
120+
multi method map(Backtrace:D: &block --> Seq:D)
121+
122+
It invokes C<&block> for each element and gathers the return values in a sequence and returns it.
123+
124+
This program:
125+
126+
sub inner { Backtrace.new.map({ say "{$_.file}: {$_.line}" }); }
127+
sub outer { inner; }
128+
outer;
129+
130+
results in:
131+
132+
=for code :lang<text>
133+
SETTING::src/core/Backtrace.pm6: 85
134+
SETTING::src/core/Backtrace.pm6: 85
135+
test.p6: 1
136+
test.p6: 2
137+
test.p6: 3
138+
test.p6: 1
139+
140+
=head2 method flat
141+
142+
Defined as:
143+
144+
multi method flat(Backtrace:D: --> List:D }
145+
146+
Returns the backtrace same as L<list|#method_list>.
147+
71148
=end pod
72149

73-
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6
150+
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)