[ruby/prism] Ensure backwards compatibility with the custom parser builder
Temoprary backwards-compat code so that current users don't break. Eventually the Translation::Parser initializer should asser that the correct class is passed in. https://github.com/ruby/prism/commit/66b0162b35
This commit is contained in:
parent
7c88cbb4a6
commit
4b844f7d9e
@ -1138,7 +1138,17 @@ module Prism
|
||||
# -> { it }
|
||||
# ^^^^^^^^^
|
||||
def visit_it_parameters_node(node)
|
||||
builder.itarg
|
||||
# FIXME: The builder _should_ always be a subclass of the prism builder.
|
||||
# Currently RuboCop passes in its own builder that always inherits from the
|
||||
# parser builder (which is lacking the `itarg` method). Once rubocop-ast
|
||||
# opts in to use the custom prism builder a warning can be emitted when
|
||||
# it is not the expected class, and eventually raise.
|
||||
# https://github.com/rubocop/rubocop-ast/pull/354
|
||||
if builder.is_a?(Translation::Parser::Builder)
|
||||
builder.itarg
|
||||
else
|
||||
builder.args(nil, [], nil, false)
|
||||
end
|
||||
end
|
||||
|
||||
# foo(bar: baz)
|
||||
|
Loading…
x
Reference in New Issue
Block a user