Skip to content

Commit

Permalink
Simplify RakuAST::Regex::CharClassEnumerationElement::Character
Browse files Browse the repository at this point in the history
It takes a single character.  No need to make that a named argument.
The name of the class is sufficient information to know what it
takes as a positional argument in .new.

Set also RakuAST.IntLiteral, RakuAST.StrLiteral, etc.
  • Loading branch information
lizmat committed Jan 14, 2023
1 parent 4db8d3e commit cdb8728
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Raku/Actions.nqp
Expand Up @@ -2815,7 +2815,7 @@ class Raku::RegexActions is HLL::Actions does Raku::CommonActions {
}
else {
my $node := self.r('Regex', 'CharClassEnumerationElement', 'Character');
@elements.push($node.new(:character(~$_[0])));
@elements.push($node.new(~$_[0]));
}
}
self.attach: $/, self.r('Regex', 'CharClassElement', 'Enumeration').new:
Expand Down Expand Up @@ -2900,7 +2900,7 @@ class Raku::RegexActions is HLL::Actions does Raku::CommonActions {

method cclass_backslash:sym<any>($/) {
self.attach: $/,
self.r('Regex', 'CharClassEnumerationElement', 'Character').new(:character(~$/));
self.r('Regex', 'CharClassEnumerationElement', 'Character').new(~$/);
}

method mod_internal($/) {
Expand Down
2 changes: 1 addition & 1 deletion src/Raku/ast/regex.rakumod
Expand Up @@ -1581,7 +1581,7 @@ class RakuAST::Regex::CharClassEnumerationElement::Character
{
has str $.character;

method new(str :$character!) {
method new(str $character) {
my $obj := nqp::create(self);
nqp::bindattr_s($obj, RakuAST::Regex::CharClassEnumerationElement::Character,
'$!character', $character);
Expand Down

0 comments on commit cdb8728

Please sign in to comment.