Skip to content

Instantly share code, notes, and snippets.

@perlpilot
Created January 31, 2017 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save perlpilot/bb541544ae518421bfd4cb64a6eb1b27 to your computer and use it in GitHub Desktop.
Save perlpilot/bb541544ae518421bfd4cb64a6eb1b27 to your computer and use it in GitHub Desktop.
diff --git a/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp
index ace9b9b..b0ecaaa 100644
--- a/src/Perl6/Actions.nqp
+++ b/src/Perl6/Actions.nqp
@@ -7832,6 +7832,8 @@ class Perl6::Actions is HLL::Actions does STDActions {
QAST::IVal.new( :value($samemark) ),
);
+ my $Sname := QAST::Node.unique("__Sname");
+
$past := QAST::Op.new( :op('locallifetime'), :node($/),
QAST::Stmt.new(
@@ -7868,12 +7870,12 @@ class Perl6::Actions is HLL::Actions does STDActions {
),
QAST::Op.new( :op('call'), :name('&infix:<=>'),
- WANTED(QAST::Var.new( :name($<sym> eq 's' ?? '$_' !! '$/'), :scope('lexical') ),'s/assign'),
+ WANTED(QAST::Var.new( :name($<sym> eq 's' ?? '$_' !! $Sname), :scope('lexical') ),'s/assign'),
$apply_matches
),
( $<sym> eq 'S'
?? QAST::Op.new( :op('p6store'),
- QAST::Var.new( :name('$/'), :scope('lexical') ),
+ QAST::Var.new( :name($Sname), :scope('lexical') ),
WANTED(QAST::Var.new( :name('$_'), :scope('lexical') ),'S'),
)
!! QAST::Stmt.new()
@@ -7909,7 +7911,8 @@ class Perl6::Actions is HLL::Actions does STDActions {
) !! QAST::Stmt.new(),
# The result of this operation.
- QAST::Var.new( :name('$/'), :scope('lexical') )
+ ($<sym> eq 's' ?? QAST::Var.new( :name('$/'), :scope('lexical') )
+ !! QAST::Var.new( :name($Sname), :scope('lexical') ) )
),
);
$past.annotate('is_S', $<sym> eq 'S');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment