Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Mark out Parrot/JVM specific bits of CORE.
  • Loading branch information
jnthn committed Apr 14, 2013
1 parent d68776e commit 11c79ea
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
33 changes: 33 additions & 0 deletions src/core/NQPMu.nqp
Expand Up @@ -69,6 +69,7 @@ my class NQPMu {
self.bless(|%attributes);
}

#?if parrot
proto method Str() is parrot_vtable('get_string') { * }
multi method Str(NQPMu:U $self:) {
''
Expand All @@ -90,6 +91,12 @@ my class NQPMu {
method defined() is parrot_vtable('defined') {
nqp::isconcrete(self)
}
#?endif
#?if !parrot
method defined() {
nqp::isconcrete(self)
}
#?endif

proto method ACCEPTS($topic) { * }
multi method ACCEPTS(NQPMu:U $self: $topic) {
Expand All @@ -100,3 +107,29 @@ my class NQPMu {
self.HOW.isa(self, $type)
}
}

#?if !parrot
# 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() { nqp::pop(self) }
method unshift($value) { nqp::unshift(self, $value) }
method shift() { 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(
'list', NQPArray,
'slurpy_array', NQPArray,
'array_iter', NQPArrayIter,
'hash_iter', NQPHashIter
));
#?endif
7 changes: 6 additions & 1 deletion src/core/NQPRoutine.nqp
Expand Up @@ -273,7 +273,12 @@ my knowhow NQPRoutine {
$i := 0;
while $i < $type_check_count {
my $param := nqp::captureposarg($capture, $i);
my $param_type := pir::what_or_null__PP($param); # Parrot hack; just .WHAT on JVM etc.
#?if parrot
my $param_type := pir::what_or_null__PP($param);
#?endif
#?if !parrot
my $param_type := $param.WHAT;
#?endif
my $type_obj := $cur_candidate<types>[$i];
my $definedness := $cur_candidate<definednesses>[$i];
unless nqp::eqaddr($param_type, $type_obj) || nqp::isnull($type_obj) || is_narrower_type($param_type, $type_obj) {
Expand Down

0 comments on commit 11c79ea

Please sign in to comment.