Skip to content

Commit

Permalink
Merge pull request #68 from cognominal/master
Browse files Browse the repository at this point in the history
Add nqp::isinvokable.
  • Loading branch information
jnthn committed Dec 8, 2012
2 parents 785d2fa + 585db6c commit 35c4b05
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/QAST/Operations.nqp
Expand Up @@ -1549,6 +1549,7 @@ QAST::Operations.add_core_pirop_mapping('unshift_n', 'unshift', '0Pn', :inlinabl
QAST::Operations.add_core_pirop_mapping('splice', 'splice', '0PPii', :inlinable(1));
QAST::Operations.add_core_pirop_mapping('islist', 'nqp_islist', 'IP', :inlinable(1));
QAST::Operations.add_core_pirop_mapping('ishash', 'nqp_ishash', 'IP', :inlinable(1));
QAST::Operations.add_core_pirop_mapping('isinvokable', 'is_invokable', 'IP', :inlinable(1));

# repr-level aggregate operations
QAST::Operations.add_core_pirop_mapping('r_atpos', 'repr_at_pos_obj', 'PPi', :inlinable(1));
Expand Down
5 changes: 4 additions & 1 deletion t/nqp/11-sub.t
Expand Up @@ -2,7 +2,7 @@

# check subs

say('1..12');
say('1..14');

sub one ( ) {
say("ok 1 # sub def and call");
Expand Down Expand Up @@ -75,3 +75,6 @@ say('ok ', Qstuff());

sub term:sym<self>() { 12 }
say('ok ', term:sym<self>());

say( (!nqp::isinvokable(sub() {}) ?? 'ok 13' !! 'no 13' ) ~ ' nqp::isinvokable on sub');
say( (!nqp::isinvokable(666) ?? 'ok 14' !! 'no 14' ) ~ ' nqp::isinvokable on non sub');

0 comments on commit 35c4b05

Please sign in to comment.