Skip to content

Commit

Permalink
RakuAST: fix some more places where code-statements should be used
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Apr 30, 2023
1 parent edaa90a commit 654fb38
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/Raku/ast/circumfix.rakumod
Expand Up @@ -47,7 +47,7 @@ class RakuAST::Circumfix::ArrayComposer
}

method canonicalize() {
my @statements := self.IMPL-UNWRAP-LIST(self.semilist.statements);
my @statements := self.semilist.code-statements;
if nqp::elems(@statements) == 1 {
self.IMPL-QUOTE-VALUE(@statements[0].expression.literal-value)
}
Expand Down Expand Up @@ -83,12 +83,12 @@ class RakuAST::Circumfix::ArrayComposer
}

method IMPL-CAN-INTERPRET() {
my @statements := self.IMPL-UNWRAP-LIST(self.semilist.statements);
my @statements := self.semilist.code-statements;
nqp::elems(@statements) == 1 && @statements[0].IMPL-CAN-INTERPRET
}

method IMPL-INTERPRET(RakuAST::IMPL::InterpContext $ctx) {
my @statements := self.IMPL-UNWRAP-LIST(self.semilist.statements);
my @statements := self.semilist.code-statements;
my $result := @statements[0].IMPL-INTERPRET($ctx);
Array.new($result)
}
Expand Down
5 changes: 3 additions & 2 deletions src/Raku/ast/expressions.rakumod
Expand Up @@ -1261,7 +1261,7 @@ class RakuAST::Postcircumfix::HashIndex

method resolve-with(RakuAST::Resolver $resolver) {
my $resolved := $resolver.resolve-lexical(
nqp::elems(self.IMPL-UNWRAP-LIST($!index.statements)) > 1
nqp::elems($!index.code-statements) > 1
?? '&postcircumfix:<{; }>'
!! '&postcircumfix:<{ }>');
if $resolved {
Expand Down Expand Up @@ -1405,7 +1405,8 @@ class RakuAST::ApplyPostfix
if nqp::istype($operand, RakuAST::Circumfix::Parentheses)
&& $operand.semilist.IMPL-IS-SINGLE-EXPRESSION
{
my $statement := self.IMPL-UNWRAP-LIST($operand.semilist.statements)[0];
my $statement :=
self.IMPL-UNWRAP-LIST($operand.semilist.code-statements)[0];
$operand := $statement.expression
unless $statement.condition-modifier || $statement.loop-modifier;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Raku/ast/statements.rakumod
Expand Up @@ -318,7 +318,7 @@ class RakuAST::StatementList
}

method visit-children(Code $visitor) {
for self.IMPL-UNWRAP-LIST(self.statements) {
for $!statements {
$visitor($_);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Raku/ast/variable-declaration.rakumod
Expand Up @@ -584,7 +584,7 @@ class RakuAST::VarDeclaration::Simple
operand => RakuAST::Declaration::ResolvedConstant.new(
:compile-time-value(
$!shape && self.sigil eq '%'
?? self.IMPL-CONTAINER-TYPE($of, :key-type(self.IMPL-UNWRAP-LIST($!shape.statements)[0].expression.compile-time-value))
?? self.IMPL-CONTAINER-TYPE($of, :key-type($!shape.code-statements[0].expression.compile-time-value))
!! self.IMPL-CONTAINER-TYPE($of)
)
),
Expand Down Expand Up @@ -702,7 +702,7 @@ class RakuAST::VarDeclaration::Simple
my $meta-object := $!attribute-package.attribute-type.new(
name => self.sigil ~ '!' ~ self.desigilname.canonicalize,
type => $!shape && self.sigil eq '%'
?? self.IMPL-CONTAINER-TYPE($of, :key-type(self.IMPL-UNWRAP-LIST($!shape.statements)[0].expression.compile-time-value))
?? self.IMPL-CONTAINER-TYPE($of, :key-type($!shape.code-statements[0].expression.compile-time-value))
!! self.IMPL-CONTAINER-TYPE($of),
has_accessor => self.twigil eq '.',
container_descriptor => $cont-desc,
Expand Down Expand Up @@ -757,7 +757,7 @@ class RakuAST::VarDeclaration::Simple
);
if $!shape || self.IMPL-HAS-CONTAINER-BASE-TYPE {
my $value := $!shape && self.sigil eq '%'
?? self.IMPL-CONTAINER-TYPE($of, :key-type(self.IMPL-UNWRAP-LIST($!shape.statements)[0].expression.compile-time-value))
?? self.IMPL-CONTAINER-TYPE($of, :key-type($!shape.code-statements[0].expression.compile-time-value))
!! self.IMPL-CONTAINER-TYPE($of);
$context.ensure-sc($value);
$qast := QAST::Op.new( :op('bind'), $qast, QAST::Op.new(
Expand Down

0 comments on commit 654fb38

Please sign in to comment.