Skip to content

Commit

Permalink
RakuAST: keep a difference in the AST for stubs with and without args
Browse files Browse the repository at this point in the history
While technically correct, we don't want a plain ... to deparse to
... 'Stub code executed'
So instead of adding default arguments to the AST, keep the default args
ephemeral.
  • Loading branch information
niner committed Jan 10, 2023
1 parent e8c23f8 commit dfd2703
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Raku/ast/call.rakumod
Expand Up @@ -614,13 +614,19 @@ class RakuAST::Stub is RakuAST::Call::Name {
method new(RakuAST::ArgList :$args) {
my $obj := nqp::create(self);
nqp::bindattr($obj, RakuAST::Call::Name, '$!name', RakuAST::Name.from-identifier(self.IMPL-FUNC-NAME));
unless $args && $args.has-args {
$args := RakuAST::ArgList.new:
RakuAST::StrLiteral.new('Stub code executed')
}
nqp::bindattr($obj, RakuAST::Call, '$!args', $args);
$obj
}

method args() {
my $args := nqp::getattr(self, RakuAST::Call, '$!args');
if $args && $args.has-args {
$args
}
else {
RakuAST::ArgList.new: RakuAST::StrLiteral.new('Stub code executed')
}
}
}

# the ... stub
Expand Down

0 comments on commit dfd2703

Please sign in to comment.