Skip to content

Commit

Permalink
Tweak to enable rebootstraping NQP on new-disp
Browse files Browse the repository at this point in the history
Our circularity saw is certainly a hack saw.
  • Loading branch information
jnthn committed Jul 20, 2021
1 parent 3f496d0 commit b6221b0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/QRegex/Cursor.nqp
Expand Up @@ -1289,7 +1289,6 @@ class NQPRegexMethod {
}
}
nqp::setinvokespec(NQPRegexMethod, NQPRegexMethod, '$!code', nqp::null);
nqp::bindhllsym('nqp', 'NQPRegexMethod', NQPRegexMethod);

class NQPRegex is NQPRegexMethod {
multi method ACCEPTS(NQPRegex:D $self: $target) {
Expand Down
28 changes: 21 additions & 7 deletions src/core/dispatchers.nqp
Expand Up @@ -85,14 +85,28 @@ nqp::dispatch('boot-syscall', 'dispatcher-register', 'nqp-call', -> $capture {
my int $is-regex := $is-routine ?? 0 !! nqp::istype($callee, NQPRegex);
my int $is-regex-method;
unless $is-routine || $is-regex {
$NQPRegexMethod := nqp::gethllsym('nqp', 'NQPRegexMethod');
if nqp::istype($callee, $NQPRegexMethod) {
$is-regex-method := 1;
my str $name := $callee.HOW.name($callee);
if $name eq 'NQPRoutine' { $is-routine := 1 }
elsif $name eq 'NQPRegexMethod' {
$NQPRegexMethod := $callee.WHAT;
$is-regex-method := 1
}
else {
my str $name := $callee.HOW.name($callee);
if $name eq 'NQPRoutine' { $is-routine := 1 }
elsif $name eq 'NQPRegex' { $is-regex := 1 }
elsif $name eq 'NQPRegex' {
# Oddly we have two of these: one subclassing NQPRegexMethod
# and another that is a KnowHOW and so has no parents.
if nqp::can($callee.HOW, 'parents') {
my @parents := $callee.HOW.parents($callee, :local);
if @parents {
my $parent := @parents[0];
if $parent.HOW.name($parent) eq 'NQPRegexMethod' {
$NQPRegexMethod := $parent.WHAT;
$is-regex-method := 1
}
}
}
unless $is-regex-method {
$is-regex := 1
}
}
}
if $is-routine {
Expand Down

0 comments on commit b6221b0

Please sign in to comment.