Skip to content

Commit 5c8e873

Browse files
committed
Merges the two definitions of make
This closes #2878. It's been there for a long time, about time we caught this bug...
1 parent 28e627d commit 5c8e873

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

doc/Type/Match.pod6

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,27 @@ Returns the payload that was set with L<C<make>|/routine/make>.
120120
121121
Defined as
122122
123-
method make(Match:D: Mu $ast)
123+
method make(Match:D: Mu $payload)
124+
sub make(Mu $payload)
124125
125-
Sets the C<.ast> attribute, also known as C<.made>.
126+
Sets the C<.ast> attribute, which will be retrieved using C<.made>.
126127
127128
$/.make("your payload here");
128129
130+
That is, it stores an arbitrary payload into the C<Match> object that can later
131+
be retrieved via L«C<.made>|/routine/made» method.
132+
133+
This is typically used in a L<grammar|/language/grammars>'s actions class
134+
methods, where a piece of data is stored by one method and then later retrieved
135+
by another. It's up to you what data you store. It could be a tree node, L<result
136+
of a calculation|/language/grammars#Protoregexes>, or a list of values.
137+
138+
The sub form operates on the current Match C<$/>, which can be a convenient shortcut:
139+
140+
method my-action ($/) {
141+
make "foo: $/";
142+
}
143+
129144
=head2 method actions
130145
131146
method actions(Match:D: --> Mu)
@@ -226,26 +241,6 @@ Returns the part of the original string following the match.
226241
"abc123def" ~~ m:g/\d/;
227242
say $/.[1].postmatch; # OUTPUT: «3def␤»
228243
229-
=head2 method make
230-
231-
method make(Match:D: Mu $payload)
232-
sub make(Mu $payload)
233-
234-
Stores an arbitrary payload into the C<Match> object that can later be retrieved
235-
via L«C<.made>|/routine/made» method.
236-
237-
This is typically used in a L<grammar|/language/grammars>'s actions class
238-
methods, where a piece of data is stored by one method and then later retrieved
239-
by another. It's up to you what data you store. It could be a tree node, L<result
240-
of a calculation|/language/grammars#Protoregexes>, or a list of values.
241-
242-
The sub form operates on the current C<$/>, which can be a convenient shortcut:
243-
244-
method my-action ($/) {
245-
make "foo: $/";
246-
}
247-
248-
249244
=head2 method infix:<eqv>
250245
251246
Defined as:

0 commit comments

Comments
 (0)