Skip to content

Commit cfd0d54

Browse files
committed
Clean up regex code object creation.
1 parent e72739f commit cfd0d54

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/NQP/Actions.pm

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,13 +1180,13 @@ class NQP::Actions is HLL::Actions {
11801180
$block[0].push(QAST::Var.new(:name<$/>, :scope<lexical>, :decl<var>));
11811181
$block.symbol('', :scope<lexical>);
11821182
$block.symbol('$/', :scope<lexical>);
1183-
my $regex := %*LANG<Regex-actions>.qbuildsub($<p6regex>.ast, $block);
1183+
my $code := $*W.create_code($block, $name, 0, :code_type_name<NQPRegex>);
1184+
my $regex := %*LANG<Regex-actions>.qbuildsub($<p6regex>.ast, $block, code_obj => $code);
11841185
$regex.name($name);
11851186

11861187
if $*PKGDECL && nqp::can($*PACKAGE.HOW, 'add_method') {
11871188
# Add the actual method.
1188-
$*W.pkg_add_method($*PACKAGE, 'add_method', $name,
1189-
$*W.create_code($regex, $name, 0, :code_type_name<NQPRegex>));
1189+
$*W.pkg_add_method($*PACKAGE, 'add_method', $name, $code);
11901190
}
11911191

11921192
# In sink context, we don't need the Regex::Regex object.
@@ -1628,4 +1628,8 @@ class NQP::RegexActions is QRegex::P6Regex::Actions {
16281628
method arg($/) {
16291629
make $<quote_EXPR>.ast;
16301630
}
1631+
1632+
method create_regex_code_object($block) {
1633+
$*W.create_code($block, '', 0, :code_type_name<NQPRegex>);
1634+
}
16311635
}

0 commit comments

Comments
 (0)