Fix node search in bindgen
This is to fix a weird bindgen behavior on Matt's branch: https://github.com/ruby/ruby/pull/7393
This commit is contained in:
parent
cc54e1cf48
commit
309dd50a01
@ -146,7 +146,14 @@ class BindingGenerator
|
||||
end
|
||||
|
||||
# TODO: Support nested declarations
|
||||
nodes_index = nodes.group_by(&:spelling).transform_values(&:last)
|
||||
nodes_index = nodes.group_by(&:spelling).transform_values do |values|
|
||||
# Try to search a declaration with definitions
|
||||
node_with_children = values.find { |v| !v.children.empty? }
|
||||
next node_with_children if node_with_children
|
||||
|
||||
# Otherwise, assume the last one is the main declaration
|
||||
values.last
|
||||
end
|
||||
|
||||
# Define types
|
||||
@types.each do |type|
|
||||
|
Loading…
x
Reference in New Issue
Block a user