зеркало из https://github.com/github/ruby.git
[ruby/prism] Make NodeKindField subclass NodeKindField
* To avoid duplication. https://github.com/ruby/prism/commit/12e5aae0b4
This commit is contained in:
Родитель
1b0a5bcb0a
Коммит
2143789a33
|
@ -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
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче