Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[6.d] πŸ§™β€β™‚οΈ Cast a spell of silence on $()/@()/%()
Per 6.d-prep[^1], remove all magick from $()/@()/%() and make them
mean the same thing as $( )/@( )/%( ) (that is, contextualizers that
call .item/.list/.hash respectively on an empty list).

Closes RT#131392 and R#1946

[1] https://github.com/perl6/6.d-prep/blob/dffa2642419a0f481591b9b64b602bfc4c4eb66b/TODO/FEATURES.md#remove--magicalness-from--and-
[2] https://rt.perl.org/Public/Bug/Display.html?id=131392
[3] #1946
  • Loading branch information
zoffixznet committed Sep 20, 2018
1 parent abbbd2a commit bb88a03
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Perl6/Actions.nqp
Expand Up @@ -3091,7 +3091,9 @@ class Perl6::Actions is HLL::Actions does STDActions {

method contextualizer($/) {
my $past := $<coercee>.ast;
if $<sigil> eq '$' && ~$<coercee> eq '' { # for '$()'
my $has_magic := $*W.lang-ver-before('d') && $<coercee> eq '';

if $has_magic && $<sigil> eq '$' { # for '$()'
my $result_var := $past.unique('sm_result');
$past := QAST::Stmt.new(
# Evaluate RHS and call ACCEPTS on it, passing in $_. Bind the
Expand Down Expand Up @@ -3127,7 +3129,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
~$<sigil> eq '%' ?? 'hash' !!
'item';
# @() and %()
$past := QAST::Var.new( :name('$/'), :scope('lexical') ) if ~$<coercee> eq '';
$past := QAST::Var.new( :name('$/'), :scope('lexical') ) if $has_magic;

$past := QAST::Op.new( :op('callmethod'), :name($name), $past );
}
Expand Down

0 comments on commit bb88a03

Please sign in to comment.