Skip to content

Commit

Permalink
Implement :tree in .^parents; fix Object.^parents which for some craz…
Browse files Browse the repository at this point in the history
…y reason I once thought should return something other than an empty list.
  • Loading branch information
jnthn committed Jul 29, 2009
1 parent 3910fce commit 6ff39ce
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/classes/ClassHOW.pir
Expand Up @@ -174,16 +174,12 @@ Gets a list of this class' parents.

# Fake top of Perl 6 hierarchy.
$S0 = parrot_class.'name'()
if $S0 != 'Perl6Object' goto not_object
unless null local goto done
$P0 = get_hll_global 'Object'
result_list.'push'($P0)
goto done
not_object:
if $S0 == 'Perl6Object' goto done

# If it's local can just use inspect.
unless null tree goto do_tree
if null local goto all_parents
do_tree:
parrot_list = inspect parrot_class, 'parents'
it = iter parrot_list
goto it_loop
Expand All @@ -209,14 +205,16 @@ Gets a list of this class' parents.
$P0 = getprop 'metaclass', $P0
$P0 = $P0.'WHAT'()
$P0 = new 'ObjectRef', $P0
if null tree goto push_this
$P1 = self.'parents'($P0, 'tree'=>tree)
$P1.'unshift'($P0)
$P0 = new 'Perl6Scalar', $P1
push_this:
result_list.'push'($P0)
goto it_loop
it_loop_end:
goto done

do_tree:
'die'(':tree not yet implemented')
done:
.return (result_list)
.end
Expand Down

0 comments on commit 6ff39ce

Please sign in to comment.