Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:rakudo/rakudo
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Feb 19, 2009
2 parents 7d6683a + 543e228 commit 6c983dc
Show file tree
Hide file tree
Showing 15 changed files with 141 additions and 438 deletions.
6 changes: 5 additions & 1 deletion build/Makefile.in
Expand Up @@ -106,7 +106,11 @@ BUILTINS_PIR = \
src/builtins/traits.pir \

SETTING = \
src/setting/Whatever.pm
src/setting/Array.pm \
src/setting/Bool.pm \
src/setting/List.pm \
src/setting/Pair.pm \
src/setting/Whatever.pm \

PMCS = perl6str objectref perl6scalar mutablevar perl6multisub

Expand Down
29 changes: 0 additions & 29 deletions perl6_s1.pir

This file was deleted.

4 changes: 2 additions & 2 deletions src/builtins/guts.pir
Expand Up @@ -147,8 +147,8 @@ subtyping relations, etc).
unless $I0 == $I1 goto not_junc
.local pmc j1, j2
.local int max, i
j1 = t1.'!eigenstates'()
j2 = t1.'!eigenstates'()
j1 = t1.'eigenstates'()
j2 = t1.'eigenstates'()
max = elements j1
i = 0
junc_loop:
Expand Down
34 changes: 0 additions & 34 deletions src/classes/Bool.pir
Expand Up @@ -39,20 +39,6 @@ symbols for C<Bool::True> and C<Bool::False>.
.end


.sub 'ACCEPTS' :method
.param pmc topic
.return (self)
.end


.sub 'perl' :method
if self goto false
.return ('Bool::False')
false:
.return ('Bool::True')
.end


.sub 'succ' :method :vtable('increment')
self = 1
.end
Expand All @@ -62,26 +48,6 @@ symbols for C<Bool::True> and C<Bool::False>.
self = 0
.end

=item Bool.pick

Returns True or False

=cut

.sub 'pick' :method
.local pmc rand
rand = get_hll_global ['Any'], '$!random'
$N0 = rand
if $N0 < 0.5 goto ret_true
$P0 = get_hll_global ['Bool'], 'False'
goto done
ret_true:
$P0 = get_hll_global ['Bool'], 'True'
done:
.tailcall 'list'($P0)
.end


=back

=cut
Expand Down
2 changes: 1 addition & 1 deletion src/classes/ClassHOW.pir
Expand Up @@ -163,7 +163,7 @@ Dispatches to method of the given name on this class or one of its parents.
autothread_invocant:
.local pmc values, values_it, res, res_list, type
res_list = 'list'()
values = obj.'!eigenstates'()
values = obj.'eigenstates'()
values_it = iter values
values_it_loop:
unless values_it goto values_it_loop_end
Expand Down
12 changes: 6 additions & 6 deletions src/classes/Junction.pir
Expand Up @@ -53,7 +53,7 @@ Return perl representation. (This should actually be autothreaded.)
type_done:

.local pmc it
$P0 = self.'!eigenstates'()
$P0 = self.'eigenstates'()
it = iter $P0
unless it goto states_done
$P0 = shift it
Expand Down Expand Up @@ -82,7 +82,7 @@ Evaluate Junction as a boolean.
.sub 'true' :method
.local pmc eigenstates, it
.local int type
eigenstates = self.'!eigenstates'()
eigenstates = self.'eigenstates'()
it = iter eigenstates
type = self.'!type'()
if type == JUNCTION_TYPE_NONE goto none
Expand Down Expand Up @@ -127,7 +127,7 @@ Smart-matching for junctions, short-circuiting.
.param pmc topic
.local pmc eigenstates, it, state
.local int type
eigenstates = self.'!eigenstates'()
eigenstates = self.'eigenstates'()
it = iter eigenstates
type = self.'!type'()
if type == JUNCTION_TYPE_NONE goto none
Expand Down Expand Up @@ -168,7 +168,7 @@ Smart-matching for junctions, short-circuiting.

Return the type of the Junction.

=item !eigenstates()
=item eigenstates()

Return the components of the Junction.

Expand All @@ -180,7 +180,7 @@ Return the components of the Junction.
.return ($P0)
.end

.sub '!eigenstates' :method
.sub 'eigenstates' :method
$P0 = getattribute self, '@!eigenstates'
.return ($P0)
.end
Expand Down Expand Up @@ -305,7 +305,7 @@ Does a junctional dispatch. XXX Needs to support named args.

have_index:
.local pmc eigenstates, it, results
eigenstates = junc.'!eigenstates'()
eigenstates = junc.'eigenstates'()
it = iter eigenstates
results = 'list'()
thread_loop:
Expand Down
30 changes: 0 additions & 30 deletions src/classes/List.pir
Expand Up @@ -205,36 +205,6 @@ Return the number of elements in the list.
.return ($I0)
.end

=item perl()

Returns a Perl representation of a List.

=cut

.sub 'perl' :method
.local string result
result = '['

.local pmc iter
iter = self.'iterator'()
unless iter goto iter_done
iter_loop:
$P1 = shift iter
if null $P1 goto iter_null
$S1 = $P1.'perl'()
result .= $S1
goto iter_next
iter_null:
result .= 'undef'
iter_next:
unless iter goto iter_done
result .= ', '
goto iter_loop
iter_done:
result .= ']'
.return (result)
.end


.namespace ['List']
.sub 'reverse' :method
Expand Down
111 changes: 0 additions & 111 deletions src/classes/Pair.pir
Expand Up @@ -20,71 +20,6 @@ src/classes/Pair.pir - methods for the Pair class
.end


=item ACCEPTS()

Called from smartmatches '$_ ~~ X'.
Delegates on to a method call '.:Xkey(Xval)'.

=cut

.sub 'ACCEPTS' :method
.param pmc topic

$S0 = self.'key'()
$S0 = concat ':', $S0

$P0 = self.'value'()

.tailcall topic.$S0($P0)
.end

=item key

Gets the key of the pair.

=cut

.sub 'key' :method
$P0 = getattribute self, '$!key'
.return ($P0)
.end

=item kv

Return key and value as a 2-element List.

=cut

.namespace ['Perl6Pair']
.sub 'kv' :method
$P0 = self.'key'()
$P1 = self.'value'()
.tailcall 'list'($P0, $P1)
.end


=item pairs

=cut

.sub 'pairs' :method
.tailcall self.'list'()
.end


=item value

Gets the value of the pair.

=cut

.sub 'value' :method
$P0 = getattribute self, '$!value'
.return ($P0)
.end



=item get_string() (vtable method)

Stringify the Pair.
Expand All @@ -100,52 +35,6 @@ Stringify the Pair.
.end


=item fmt

our Str multi Pair::fmt ( Str $format )

Returns the invocant pair formatted by an implicit call to C<sprintf> on
the key and value.

=cut

.sub 'fmt' :method
.param pmc format

.local pmc retv
.local pmc key
.local pmc value

key = self.'key'()
value = self.'value'()
retv = 'sprintf'(format, key, value)

.return(retv)
.end

=item perl

Returns a Perl code representation of the pair.

=cut

.sub perl :method
# Get key and value.
$P0 = self.'key'()
$P1 = self.'value'()

# Get perl representation
$S0 = $P0.'perl'()
$S1 = $P1.'perl'()

# build result
.local string result
result = concat $S0, ' => '
result .= $S1
.return (result)
.end


.namespace []

.sub 'infix:=>'
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Signature.pir
Expand Up @@ -75,7 +75,7 @@ the Signature.
cur_list = 'all'($P0)
attr["type"] = cur_list
have_type_attr:
cur_list = cur_list.'!eigenstates'()
cur_list = cur_list.'eigenstates'()
cur_list_iter = iter cur_list
cur_list_loop:
unless cur_list_iter goto cur_list_loop_end
Expand Down

0 comments on commit 6c983dc

Please sign in to comment.