~ubuntu-branches/ubuntu/precise/rakudo/precise

« back to all changes in this revision

Viewing changes to src/builtins/Associative.pir

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghedini
  • Date: 2011-05-17 11:31:09 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110517113109-rmfir654u1axbpt4
Tags: 0.1~2011.04-1
* New upstream release (Closes: #601862, #585762, #577502)
* New maintainer
* Switch to 3.0 (quilt) format
* Update dependencies (Closes: #584498)
* Update debian/copyright to lastest DEP5 revision
* Do not generate/install perl6 manpage (now done by the build system)
* Enable tests
* Bump Standards-Version to 3.9.2 (no changes needed)
* Do not install extra LICENSE files and duplicated docs
* Remove debian/clean (no more needed)
* Add Vcs-* fields in debian/control
* Rewrite (short) description
* Update upstream copyright years
* Upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
## $Id$
 
2
 
 
3
=head1 NAME
 
4
 
 
5
src/classes/Associative.pir - Associative Role
 
6
 
 
7
=head1 DESCRIPTION
 
8
 
 
9
Actually these days, Associative is defined in Perl 6 and this is
 
10
just a postcircumfix:<{ }> for non-Perl 6 types mapper.
 
11
 
 
12
=cut
 
13
 
 
14
=item !postcircumfix:<{ }>
 
15
 
 
16
Because foreign (non-Rakudo) Parrot objects generally won't
 
17
understand the "postcircumfix:<{ }>" method, we generate
 
18
postcircumfix as a private call to this function, and this
 
19
function then delegates to the appropriate method.  In the
 
20
case we want a single value, then it just does the lookup;
 
21
otherwise, we rely on the method dispatches for the complex
 
22
cases looping back to here to get the one value.
 
23
 
 
24
=cut
 
25
 
 
26
.namespace []
 
27
.sub '!postcircumfix:<{ }>'
 
28
    .param pmc invocant
 
29
    .param pmc args            :optional
 
30
    .param int has_args        :opt_flag
 
31
 
 
32
    $I0 = can invocant, 'postcircumfix:<{ }>'
 
33
    if $I0 goto object_method
 
34
    $I0 = isa invocant, 'Mu'
 
35
    if $I0 goto object_method
 
36
  foreign:
 
37
    $P0 = get_hll_global ['Associative[::T]'], 'postcircumfix:<{ }>'
 
38
    unless has_args goto foreign_zen
 
39
    $P1 = invocant.$P0(args)
 
40
    .return ($P1)
 
41
  foreign_zen:
 
42
    $P1 = invocant.$P0()
 
43
    .return ($P1)
 
44
  object_method:
 
45
    unless has_args goto object_zen
 
46
    $P1 = invocant.'postcircumfix:<{ }>'(args)
 
47
    .return ($P1)
 
48
  object_zen:
 
49
    $P1 = invocant.'postcircumfix:<{ }>'()
 
50
    .return ($P1)
 
51
.end
 
52
 
 
53
=back
 
54
 
 
55
=cut
 
56
 
 
57
# Local Variables:
 
58
#   mode: pir
 
59
#   fill-column: 100
 
60
# End:
 
61
# vim: expandtab shiftwidth=4 ft=pir:
 
62