Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add a couple of ops for checking if we have a VM list/hash.
  • Loading branch information
jnthn committed Oct 1, 2011
1 parent dd1307e commit f1eba49
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Perl6/Actions.pm
Expand Up @@ -16,6 +16,8 @@ INIT {
attrinited => 'repr_is_attr_initialized__IPPs',

istype => 'type_check__IPP',
islist => 'perl6_is_list__IP',
ishash => 'perl6_is_hash__IP',
lcm_i => 'lcm__Iii',
gcd_i => 'gcd__Iii',
find_method => 'find_method__PPs',
Expand Down
28 changes: 28 additions & 0 deletions src/ops/perl6.ops
Expand Up @@ -944,6 +944,34 @@ inline op perl6_current_args_rpa(out PMC) :base_core {
}


/*

=item perl6_is_list(out INT, in PMC)

Checks if the passed object is a RPA.

=cut

*/
inline op perl6_is_list(out INT, in PMC) :base_core {
$1 = $2->vtable->base_type == enum_class_ResizablePMCArray;
}


/*

=item perl6_is_hash(out INT, in PMC)

Checks if the passed object is a (VM) hash.

=cut

*/
inline op perl6_is_hash(out INT, in PMC) :base_core {
$1 = $2->vtable->base_type == enum_class_Hash;
}


/*

=item perl6_parcel_from_rpa(out PMC, in PMC, in PMC)
Expand Down

0 comments on commit f1eba49

Please sign in to comment.