Permalink
Browse files

Make regex declartors work out of sink context and smartmatch correct…

…ly. Mostly fixes 45-smartmatch.t (if you remove the last test, which compile fails while building the NFA).
  • Loading branch information...
1 parent 124f95e commit a9157445007e9c3956f89e09daf161a829db38e0 @jnthn jnthn committed Nov 15, 2011
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/NQPQ/Actions.pm
View
@@ -1054,15 +1054,18 @@ class NQP::Actions is HLL::Actions {
$block.symbol('$/', :scope<lexical>);
my $regex := QRegex::P6Regex::Actions::buildsub($<p6regex>.ast, $block);
$regex.name($name);
- my $prefix_meth;
if $*PKGDECL && pir::can($*PACKAGE.HOW, 'add_method') {
# Add the actual method.
$*SC.pkg_add_method($*PACKAGE, 'add_method', $name, $regex, 0);
}
# In sink context, we don't need the Regex::Regex object.
- $past := $regex;
+ $past := PAST::Op.new(
+ :pasttype<callmethod>, :name<new>,
+ lexical_package_lookup(['NQPRegexMethod'], $/),
+ $regex);
+ $past<sink> := $regex;
}
make $past;
}

0 comments on commit a915744

Please sign in to comment.