Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add support an test for nqp::invokable()

  • Loading branch information...
commit 585db6c540b2dff976a2044c8dc376a3e2ced2dc 1 parent 785d2fa
@cognominal cognominal authored
Showing with 5 additions and 1 deletion.
  1. +1 −0  src/QAST/Operations.nqp
  2. +4 −1 t/nqp/11-sub.t
View
1  src/QAST/Operations.nqp
@@ -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));
View
5 t/nqp/11-sub.t
@@ -2,7 +2,7 @@
# check subs
-say('1..12');
+say('1..14');
sub one ( ) {
say("ok 1 # sub def and call");
@@ -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');
Please sign in to comment.
Something went wrong with that request. Please try again.