Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Provide nqp:: ops for low-level iterator usage.
NQP will continue to support the $_.key/$_.value approach for hash
iteration in normal code. However, off Parrot this will be provided
through the NQPCORE.setting, and thus is not available to the MOP.
Essentially, these ops are to saw a circularity that we got away with
up until now, but isn't really sensible to burden other backends with.
  • Loading branch information
jnthn committed Jan 16, 2013
1 parent 56d2292 commit 5826673
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/QAST/Operations.nqp
Expand Up @@ -1529,7 +1529,6 @@ QAST::Operations.add_core_pirop_mapping('deletepos', 'delete', '0Qi', :inlinable
QAST::Operations.add_core_pirop_mapping('existskey', 'exists', 'IQs', :inlinable(1));
QAST::Operations.add_core_pirop_mapping('existspos', 'exists', 'IQi', :inlinable(1));
QAST::Operations.add_core_pirop_mapping('elems', 'elements', 'IP', :inlinable(1));
QAST::Operations.add_core_pirop_mapping('iterator', 'iter', 'PP', :inlinable(1));
QAST::Operations.add_core_pirop_mapping('push', 'push', '0PP', :inlinable(1));
QAST::Operations.add_core_pirop_mapping('push_s', 'push', '0Ps', :inlinable(1));
QAST::Operations.add_core_pirop_mapping('push_i', 'push', '0Pi', :inlinable(1));
Expand All @@ -1550,6 +1549,13 @@ QAST::Operations.add_core_pirop_mapping('splice', 'splice', '0PPii', :inlinable(
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));
QAST::Operations.add_core_pirop_mapping('iterator', 'iter', 'PP', :inlinable(1));
QAST::Operations.add_core_op('iterkey_s', -> $qastcomp, $op {
$qastcomp.as_post(QAST::Op.new( :op('callmethod'), :name('key'), $op[0] ))
});
QAST::Operations.add_core_op('iterval', -> $qastcomp, $op {
$qastcomp.as_post(QAST::Op.new( :op('callmethod'), :name('value'), $op[0] ))
});

# repr-level aggregate operations
QAST::Operations.add_core_pirop_mapping('r_atpos', 'repr_at_pos_obj', 'PPi', :inlinable(1));
Expand Down

0 comments on commit 5826673

Please sign in to comment.