Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Array and iterator types for NQP.
This provides the proper NQP semantics for hash iteration (that is,
a .key and .value method).
  • Loading branch information
jnthn committed Feb 24, 2013
1 parent aac1e22 commit c2321ad
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions nqp-src/NQPCORE.setting
Expand Up @@ -554,6 +554,29 @@ my class NQPMu {
}
}

# A few bits when we're bootstrapping everything 6model-style rather than using
# Parrot-supplied things.
my class NQPArray is repr('VMArray') {
method push($value) { nqp::push(self, $value) }
method pop($value) { nqp::pop(self) }
method unshift($value) { nqp::unshift(self, $value) }
method shift($value) { nqp::shift(self) }
}
nqp::setboolspec(NQPArray, 8, nqp::null());
my class NQPArrayIter is repr('VMIter') { }
nqp::setboolspec(NQPArrayIter, 7, nqp::null());
my class NQPHashIter is repr('VMIter') {
method key() { nqp::iterkey_s(self) }
method value() { nqp::iterval(self) }
method Str() { nqp::iterkey_s(self) }
}
nqp::setboolspec(NQPHashIter, 7, nqp::null());
nqp::sethllconfig('nqp', nqp::hash(
'slurpy_array', NQPArray,
'array_iter', NQPArrayIter,
'hash_iter', NQPHashIter
));

# From src\core\NQPCapture.pm

my class NQPCapture {
Expand Down

0 comments on commit c2321ad

Please sign in to comment.