[ruby/prism] Make NodeKindField subclass NodeKindField

* To avoid duplication.

https://github.com/ruby/prism/commit/12e5aae0b4
This commit is contained in:
Benoit Daloze 2024-02-28 18:51:45 +01:00 коммит произвёл git
Родитель 1b0a5bcb0a
Коммит 2143789a33
1 изменённых файлов: 2 добавлений и 15 удалений

Просмотреть файл

@ -145,7 +145,7 @@ module Prism
# This represents a field on a node that is a list of nodes. We pass them as
# references and store them directly on the struct.
class NodeListField < Field
class NodeListField < NodeKindField
def rbs_class
if specific_kind
"Array[#{specific_kind}]"
@ -161,20 +161,7 @@ module Prism
end
def java_type
if specific_kind
"#{specific_kind}[]"
else
"Node[]"
end
end
# TODO: unduplicate with NodeKindField
def specific_kind
options[:kind] unless options[:kind].is_a?(Array)
end
def union_kind
options[:kind] if options[:kind].is_a?(Array)
"#{super}[]"
end
end