# New Ticket Created by Vasily Chekalkin # Please include the string: [perl #59394] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=59394 >
Hello. There is implementation of Pair.pairs. +3 passed tests in "S29-hash/pairs.t" -- Bacek.
diff --git a/languages/perl6/src/classes/Pair.pir b/languages/perl6/src/classes/Pair.pir index 2aa69b0..e9a74dc 100644 --- a/languages/perl6/src/classes/Pair.pir +++ b/languages/perl6/src/classes/Pair.pir @@ -16,6 +16,9 @@ src/classes/Pair.pir - methods for the Pair class .local pmc p6meta p6meta = get_hll_global ['Perl6Object'], '$!P6META' p6meta.'new_class'('Perl6Pair', 'parent'=>'Any', 'attr'=>'$!key $!value', 'name'=>'Pair') + + $P0 = get_hll_namespace ['Perl6Pair'] + '!EXPORT'('pairs', $P0) .end =item key @@ -81,6 +84,18 @@ Returns a Perl code representation of the pair. .return (result) .end +=item pairs() + +Return a list of Pair(index, value) elements for the invocant. + +=cut + +.sub 'pairs' :method + .local pmc res + res = 'list'() + res.'push'(self) + .return (res) +.end .namespace []