Skip to content

Commit 4371629

Browse files
committed
Use set_default_parent from actions.
1 parent de0e355 commit 4371629

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/NQP/Actions.pm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,16 +511,19 @@ class NQP::Actions is HLL::Actions {
511511
PAST::Var.new( :name(~$name), :namespace(@ns), :scope('package') )
512512
));
513513
}
514-
elsif $*PKGDECL eq 'grammar' {
514+
elsif pir::can($how, 'set_default_parent') {
515+
# Set default parent.
515516
$*PACKAGE-SETUP.push(PAST::Op.new(
516-
:pasttype('callmethod'), :name('add_parent'),
517+
:pasttype('callmethod'), :name('set_default_parent'),
517518
PAST::Op.new(
518519
# XXX nqpop get_how
519520
:pirop('get_how PP'),
520521
PAST::Var.new( :name('type_obj'), :scope('register') )
521522
),
522523
PAST::Var.new( :name('type_obj'), :scope('register') ),
523-
PAST::Var.new( :name('Cursor'), :namespace('Regex'), :scope('package') )
524+
($*PKGDECL eq 'grammar' ??
525+
PAST::Var.new( :name('Cursor'), :namespace('Regex'), :scope('package') ) !!
526+
PAST::Var.new( :name('NQPMu'), :namespace([]), :scope('package') ))
524527
));
525528
}
526529

0 commit comments

Comments
 (0)