Skip to content

Commit

Permalink
Refactor !postcircumfix:<[ ]> into Positional.pir .
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Feb 12, 2010
1 parent 952d99e commit adc7d3a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 33 deletions.
1 change: 0 additions & 1 deletion build/Makefile.in
Expand Up @@ -135,7 +135,6 @@ CHEATS_PIR = \
src/cheats/autoincrement.pir \
src/cheats/fail.pir \
src/cheats/object.pir \
src/cheats/postcircumfix-array.pir \
src/cheats/postcircumfix-hash.pir \
src/cheats/int-ops.pir \
src/cheats/num-ops.pir \
Expand Down
24 changes: 17 additions & 7 deletions src/builtins/Positional.pir
Expand Up @@ -162,22 +162,32 @@ Returns the type constraining what may be stored.
.end


=item !postcircumfix:<[ ]>

Because foreign (non-Rakudo) Parrot objects generally won't
understand the "postcircumfix:<[ ]>" method, we generate
postcircumfix as a private call to this function, and this
function then delegates to the appropriate method. For PMCs
that don't have a postcircumfix:<[ ]> method, we directly
use the one in Positional.

=cut

.namespace []
.sub 'postcircumfix:[ ]'
.sub '!postcircumfix:<[ ]>'
.param pmc invocant
.param pmc args :slurpy
.param pmc options :slurpy :named
$I0 = can invocant, 'postcircumfix:[ ]'
.param pmc args :slurpy
$I0 = can invocant, 'postcircumfix:<[ ]>'
if $I0 goto object_method
$I0 = isa invocant, 'Mu'
if $I0 goto object_method
foreign:
$P0 = get_hll_global ['Positional[::T]'], 'postcircumfix:[ ]'
.tailcall $P0(invocant, args :flat, options :flat :named)
die "Can't postcircumfix:<[ ]> foreign objects yet."
object_method:
.tailcall invocant.'postcircumfix:[ ]'(args :flat, options :flat :named)
.tailcall invocant.'postcircumfix:<[ ]>'(args :flat)
.end


=back

=cut
Expand Down
25 changes: 0 additions & 25 deletions src/cheats/postcircumfix-array.pir

This file was deleted.

0 comments on commit adc7d3a

Please sign in to comment.