Skip to content

Commit

Permalink
[ruby/prism] Make NodeKindField subclass NodeKindField
Browse files Browse the repository at this point in the history
* To avoid duplication.

ruby/prism@12e5aae0b4
  • Loading branch information
eregon authored and matzbot committed Feb 28, 2024
1 parent 1b0a5bc commit 2143789
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions prism/templates/template.rb
Expand Up @@ -145,7 +145,7 @@ def rbi_class

# 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}]"
Expand All @@ -161,20 +161,7 @@ def rbi_class
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

Expand Down

0 comments on commit 2143789

Please sign in to comment.