Permalink
Browse files

Allow <foo=$bar> to work (fixes #95)

  • Loading branch information...
1 parent bfba5a3 commit 88d20b0ca04edfea47217daeb5128dac346d66d3 @sorear committed Dec 27, 2011
Showing with 21 additions and 5 deletions.
  1. +14 −5 src/RxOp.pm6
  2. +7 −0 test3.pl
View
@@ -558,15 +558,19 @@ class Statement is RxOp {
method lad() { ['Null'] }
}
-class ProtoRedis is RxOp {
+class ProtoRedis is RxOp::Capturing {
+ method clone(*%args) {
+ self.WHAT.new(captures => $.captures, |%args);
+ }
+
method code($) {
my $bt = self.label;
my @code;
push @code, CgOp.rxcall("InitCursorList",
CgOp.rxlprim('proto_dispatch', CgOp.scopedlex('Any')));
push @code, CgOp.label($bt);
- push @code, CgOp.rxincorpshift(['dispatch'], $bt);
+ push @code, CgOp.rxincorpshift($.captures, $bt);
@code;
}
@@ -634,22 +638,27 @@ class RxOp::StringCap is RxOp::Capturing {
method lad() { $.zyg[0].lad }
}
-class RxOp::ListPrim is RxOp {
+class RxOp::ListPrim is RxOp::Capturing {
has Str $.name; # used for LTM cheatery
has Str $.type;
- has $.ops = die "RxOp::Variable.ops required"; # Op
+ has $.ops = die "RxOp::ListPrim.ops required"; # Op
method ctxopzyg() { $!ops, 1 }
method opzyg() { $!ops }
+ method clone(*%args) {
+ self.WHAT.new(captures => $.captures, name => $!name, type => $!type,
+ ops => $!ops, |%args);
+ }
+
method code($body) {
my $bt = self.label;
my @code;
push @code, CgOp.rxcall("InitCursorList",
CgOp.rxlprim($!type, $!ops.cgop($body)));
push @code, CgOp.label($bt);
- push @code, CgOp.rxincorpshift([], $bt);
+ push @code, CgOp.rxincorpshift($.captures, $bt);
@code;
}
View
@@ -27,3 +27,10 @@
s/\d//;
is ~$/, '5', 's/// resets $/';
}
+
+{
+ my $hello = "'/'hello'/'(<-[\\\\/\\\\.]>+)";
+ my $reg = / ^ <hello=$hello> $/;
+ "/hello/bug" ~~ $reg;
+ is $/<hello>[0], 'bug', '<foo=$bar> works';
+}

0 comments on commit 88d20b0

Please sign in to comment.