Skip to content

Commit

Permalink
+ ruby33.y: extract arg_splat rule. (#981)
Browse files Browse the repository at this point in the history
This commit tracks upstream commit ruby/ruby@11c2aa0.
  • Loading branch information
iliabylich authored Dec 29, 2023
1 parent 7c9498f commit a80f672
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions lib/parser/ruby33.y
Original file line number Diff line number Diff line change
Expand Up @@ -1116,33 +1116,27 @@ rule
{
result = [ val[0] ]
}
| tSTAR arg_value
{
result = [ @builder.splat(val[0], val[1]) ]
}
| tSTAR
{
if !@static_env.declared_anonymous_restarg?
diagnostic :error, :no_anonymous_restarg, nil, val[0]
end
result = [ @builder.forwarded_restarg(val[0]) ]
}
| arg_splat
| args tCOMMA arg_value
{
result = val[0] << val[2]
}
| args tCOMMA tSTAR arg_value
| args tCOMMA arg_splat
{
result = val[0] << @builder.splat(val[2], val[3])
result = val[0].concat(val[2])
}
arg_splat: tSTAR arg_value
{
result = [ @builder.splat(val[0], val[1]) ]
}
| args tCOMMA tSTAR
| tSTAR
{
if !@static_env.declared_anonymous_restarg?
diagnostic :error, :no_anonymous_restarg, nil, val[2]
diagnostic :error, :no_anonymous_restarg, nil, val[0]
end
result = val[0] << @builder.forwarded_restarg(val[2])
result = [ @builder.forwarded_restarg(val[0]) ]
}
mrhs_arg: mrhs
Expand Down

0 comments on commit a80f672

Please sign in to comment.