Author: tene Date: Sun Aug 10 22:03:18 2008 New Revision: 30165 Modified: trunk/languages/cardinal/src/classes/Hash.pir
Log: [cardinal] Hash.to_a Modified: trunk/languages/cardinal/src/classes/Hash.pir ============================================================================== --- trunk/languages/cardinal/src/classes/Hash.pir (original) +++ trunk/languages/cardinal/src/classes/Hash.pir Sun Aug 10 22:03:18 2008 @@ -139,6 +139,25 @@ each_loop_end: .end +.sub 'to_a' :method + .local pmc newlist + .local pmc item + .local pmc iter + newlist = new 'CardinalArray' + iter = new 'Iterator', self + each_loop: + unless iter goto each_loop_end + $P1 = shift iter + $P2 = iter[$P1] + item = new 'CardinalArray' + push item, $P1 + push item, $P2 + push newlist, item + goto each_loop + each_loop_end: + .return (newlist) +.end + ## FIXME: Parrot currently requires us to write our own "clone" method. .sub 'clone' :vtable :method
