Skip to content

Commit

Permalink
Update Parlour and resolve root namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
dorner committed Jul 19, 2023
1 parent 7c4d5ae commit 595f384
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions lib/sord/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,21 @@ def self.add_rbi_objects_to_paths(nodes, names_to_paths, path=[])
klasses = [
Parlour::RbiGenerator::Constant,
Parlour::RbiGenerator::ModuleNamespace,
Parlour::RbiGenerator::ClassNamespace
Parlour::RbiGenerator::ClassNamespace,
Parlour::RbiGenerator::Namespace
]
child_only_classes = [
Parlour::RbiGenerator::Namespace
]
nodes.each do |node|
next unless klasses.include?(node.class)
new_path = path + [node.name]
names_to_paths[node.name] ||= Set.new
names_to_paths[node.name] << new_path.join('::')
add_rbi_objects_to_paths(node.children, names_to_paths, new_path) if node.respond_to?(:children)
if klasses.include?(node.class)
new_path = path + [node.name]
unless child_only_classes.include?(node.class)
names_to_paths[node.name] ||= Set.new
names_to_paths[node.name] << new_path.join('::')
end
add_rbi_objects_to_paths(node.children, names_to_paths, new_path) if node.respond_to?(:children)
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion sord.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'yard'
spec.add_dependency 'sorbet-runtime'
spec.add_dependency 'commander', '~> 4.5'
spec.add_dependency 'parlour', '~> 5.0'
spec.add_dependency 'parlour', '~> 8.0'
spec.add_dependency 'rbs', '~> 3.0'

spec.add_development_dependency "bundler", "~> 2.0"
Expand Down

0 comments on commit 595f384

Please sign in to comment.