Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/core/Cool-str.pm b/src/core/Cool-str.pm
- index a045cd4..e231260 100644
- --- a/src/core/Cool-str.pm
- +++ b/src/core/Cool-str.pm
- @@ -28,8 +28,19 @@ augment class Cool {
- return self if @matches == 1 && !@matches[0];
- my $prev = 0;
- my $result = '';
- + my $caller_pad = Q:PIR{
- + $P0 = getinterp
- + %r = $P0['lexpad';1]
- + };
- for @matches -> $m {
- $result ~= self.substr($prev, $m.from - $prev);
- + Q:PIR {
- + $P0 = find_lex '$caller_pad'
- + if null $P0 goto match_set_done
- + $P1 = find_lex '$m'
- + $P0['$/'] = $P1
- + match_set_done:
- + } if $replacement ~~ Callable;
- $result ~= ~($replacement ~~ Callable
- ?? $replacement($m)
- !! $replacement);
- # this is how it fails:
- ./perl6 -e 'my $x = "foo"; $x.=subst(/./, "F")'
- make: Nothing to be done for `all'.
- Null PMC access in can()
- current instr.: '&infix:<=>' pc 17802 (src/builtins/Junction.pir:198)
- called from Sub 'perl6;Cool;subst' pc 421821 (src/gen/core.pir:0)
- called from Sub '!dispatch_.=' pc 438 (src/glue/dispatch.pir:117)
- called from Sub '_block14' pc 29 (EVAL_1:0)
- called from Sub '!YOU_ARE_HERE' pc 383924 (src/gen/core.pir:29685)
- called from Sub '!UNIT_START' pc 1400 (src/glue/run.pir:21)
- called from Sub 'perl6;HLL;Compiler;_block432' pc -1 ((unknown file):-1)
- called from Sub 'perl6;HLL;Compiler;eval' pc 21950 (ext/nqp-rx/src/stage0/HLL-s0.pir:7074)
- called from Sub 'perl6;PCT;HLLCompiler;command_line' pc 1504 (compilers/pct/src/PCT/HLLCompiler.pir:801)
- called from Sub 'perl6;Perl6;Compiler;main' pc -1 ((unknown file):-1)
Add Comment
Please, Sign In to add comment