Skip to content

Commit

Permalink
RakuAST: remove some unnecessary <sym> captures
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Sep 17, 2023
1 parent c776e55 commit 19bd308
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/Raku/Actions.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -699,10 +699,9 @@ class Raku::Actions is HLL::Actions does Raku::CommonActions {
# collect the if and all of the elsifs / orwiths
my @elsifs;
my $index := 0;
my @IF-PARTS := @*IF-PARTS;
for $<sym> {
for @*IF-PARTS {
@elsifs.push:
Nodify('Statement',@IF-PARTS.shift).new:
Nodify('Statement',$_).new:
condition => $<condition>[$index].ast,
then => $<then>[$index].ast;
++$index;
Expand Down
6 changes: 3 additions & 3 deletions src/Raku/Grammar.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ grammar Raku::Grammar is HLL::Grammar does Raku::Common {
# Handle "while" / "until"
rule statement-control:sym<while> {
:my $*WHILE;
$<sym>=[<.block-while>|<.block-until>]<.kok>
[<.block-while>|<.block-until>]<.kok>
{}
:my $*GOAL := '{';
:my $*BORG := {};
Expand Down Expand Up @@ -1291,15 +1291,15 @@ grammar Raku::Grammar is HLL::Grammar does Raku::Common {
# Handle "if" / "with"
rule statement-control:sym<if> {
:my @*IF-PARTS;
$<sym>=[<.block-if>|<.block-with>]<.kok>
[<.block-if>|<.block-with>]<.kok>
{}
:my $*GOAL := '{';
:my $*BORG := {};
<condition=.EXPR> # initial condition
<then=.pointy-block> # initial body
[ # any elsifs/orwiths
[
| $<sym>=[<.block-elsif>|<.block-orwith>]
| [<.block-elsif>|<.block-orwith>]
<condition=.EXPR>
<then=.pointy-block>
Expand Down

0 comments on commit 19bd308

Please sign in to comment.