yoda-language-server 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +16 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +8 -0
  5. data/Gemfile +6 -0
  6. data/Gemfile.lock +78 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +85 -0
  9. data/Rakefile +6 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/client/atom/main.js +27 -0
  13. data/client/vscode/.gitignore +4 -0
  14. data/client/vscode/.vscode/launch.json +28 -0
  15. data/client/vscode/.vscode/settings.json +9 -0
  16. data/client/vscode/.vscode/tasks.json +20 -0
  17. data/client/vscode/.vscodeignore +8 -0
  18. data/client/vscode/CHANGELOG.md +7 -0
  19. data/client/vscode/README.md +65 -0
  20. data/client/vscode/package-lock.json +2688 -0
  21. data/client/vscode/package.json +39 -0
  22. data/client/vscode/src/extension.ts +42 -0
  23. data/client/vscode/src/test/extension.test.ts +22 -0
  24. data/client/vscode/src/test/index.ts +22 -0
  25. data/client/vscode/tsconfig.json +16 -0
  26. data/client/vscode/vsc-extension-quickstart.md +33 -0
  27. data/exe/yoda +27 -0
  28. data/lib/yoda.rb +11 -0
  29. data/lib/yoda/evaluation.rb +9 -0
  30. data/lib/yoda/evaluation/code_completion.rb +65 -0
  31. data/lib/yoda/evaluation/code_completion/base_provider.rb +57 -0
  32. data/lib/yoda/evaluation/code_completion/const_provider.rb +90 -0
  33. data/lib/yoda/evaluation/code_completion/method_provider.rb +82 -0
  34. data/lib/yoda/evaluation/code_completion/variable_provider.rb +18 -0
  35. data/lib/yoda/evaluation/comment_completion.rb +70 -0
  36. data/lib/yoda/evaluation/comment_completion/base_provider.rb +64 -0
  37. data/lib/yoda/evaluation/comment_completion/param_provider.rb +18 -0
  38. data/lib/yoda/evaluation/comment_completion/tag_provider.rb +41 -0
  39. data/lib/yoda/evaluation/comment_completion/type_provider.rb +58 -0
  40. data/lib/yoda/evaluation/current_node_explain.rb +70 -0
  41. data/lib/yoda/evaluation/evaluator.rb +103 -0
  42. data/lib/yoda/evaluation/signature_discovery.rb +83 -0
  43. data/lib/yoda/model.rb +12 -0
  44. data/lib/yoda/model/completion_item.rb +56 -0
  45. data/lib/yoda/model/descriptions.rb +10 -0
  46. data/lib/yoda/model/descriptions/base.rb +26 -0
  47. data/lib/yoda/model/descriptions/function_description.rb +40 -0
  48. data/lib/yoda/model/descriptions/value_description.rb +33 -0
  49. data/lib/yoda/model/descriptions/word_description.rb +32 -0
  50. data/lib/yoda/model/function_signatures.rb +13 -0
  51. data/lib/yoda/model/function_signatures/base.rb +68 -0
  52. data/lib/yoda/model/function_signatures/constructor.rb +70 -0
  53. data/lib/yoda/model/function_signatures/formatter.rb +82 -0
  54. data/lib/yoda/model/function_signatures/method.rb +67 -0
  55. data/lib/yoda/model/function_signatures/overload.rb +79 -0
  56. data/lib/yoda/model/function_signatures/parameter_list.rb +108 -0
  57. data/lib/yoda/model/function_signatures/type_builder.rb +101 -0
  58. data/lib/yoda/model/node_signature.rb +28 -0
  59. data/lib/yoda/model/path.rb +96 -0
  60. data/lib/yoda/model/scoped_path.rb +44 -0
  61. data/lib/yoda/model/types.rb +84 -0
  62. data/lib/yoda/model/types/any_type.rb +32 -0
  63. data/lib/yoda/model/types/base.rb +37 -0
  64. data/lib/yoda/model/types/duck_type.rb +41 -0
  65. data/lib/yoda/model/types/function_type.rb +174 -0
  66. data/lib/yoda/model/types/generic_type.rb +66 -0
  67. data/lib/yoda/model/types/instance_type.rb +42 -0
  68. data/lib/yoda/model/types/module_type.rb +42 -0
  69. data/lib/yoda/model/types/sequence_type.rb +53 -0
  70. data/lib/yoda/model/types/union_type.rb +56 -0
  71. data/lib/yoda/model/types/unknown_type.rb +40 -0
  72. data/lib/yoda/model/types/value_type.rb +58 -0
  73. data/lib/yoda/model/values.rb +9 -0
  74. data/lib/yoda/model/values/base.rb +32 -0
  75. data/lib/yoda/model/values/instance_value.rb +65 -0
  76. data/lib/yoda/model/values/module_value.rb +72 -0
  77. data/lib/yoda/parsing.rb +15 -0
  78. data/lib/yoda/parsing/ast_traversable.rb +18 -0
  79. data/lib/yoda/parsing/comment_tokenizer.rb +59 -0
  80. data/lib/yoda/parsing/location.rb +101 -0
  81. data/lib/yoda/parsing/node_objects.rb +10 -0
  82. data/lib/yoda/parsing/node_objects/const_node.rb +52 -0
  83. data/lib/yoda/parsing/node_objects/method_definition.rb +46 -0
  84. data/lib/yoda/parsing/node_objects/namespace.rb +104 -0
  85. data/lib/yoda/parsing/node_objects/send_node.rb +72 -0
  86. data/lib/yoda/parsing/parser.rb +27 -0
  87. data/lib/yoda/parsing/query.rb +11 -0
  88. data/lib/yoda/parsing/query/current_comment_query.rb +80 -0
  89. data/lib/yoda/parsing/query/current_comment_token_query.rb +153 -0
  90. data/lib/yoda/parsing/query/current_commenting_node_query.rb +68 -0
  91. data/lib/yoda/parsing/query/current_location_node_query.rb +51 -0
  92. data/lib/yoda/parsing/query/current_node_comment_query.rb +40 -0
  93. data/lib/yoda/parsing/range.rb +41 -0
  94. data/lib/yoda/parsing/scopes.rb +15 -0
  95. data/lib/yoda/parsing/scopes/base.rb +78 -0
  96. data/lib/yoda/parsing/scopes/builder.rb +60 -0
  97. data/lib/yoda/parsing/scopes/class_definition.rb +47 -0
  98. data/lib/yoda/parsing/scopes/meta_class_definition.rb +44 -0
  99. data/lib/yoda/parsing/scopes/meta_method_definition.rb +70 -0
  100. data/lib/yoda/parsing/scopes/method_definition.rb +69 -0
  101. data/lib/yoda/parsing/scopes/module_definition.rb +36 -0
  102. data/lib/yoda/parsing/scopes/root.rb +25 -0
  103. data/lib/yoda/parsing/source_analyzer.rb +59 -0
  104. data/lib/yoda/parsing/source_cutter.rb +231 -0
  105. data/lib/yoda/parsing/type_parser.rb +141 -0
  106. data/lib/yoda/runner.rb +6 -0
  107. data/lib/yoda/runner/infer.rb +50 -0
  108. data/lib/yoda/runner/setup.rb +26 -0
  109. data/lib/yoda/server.rb +191 -0
  110. data/lib/yoda/server/client_info.rb +98 -0
  111. data/lib/yoda/server/completion_provider.rb +78 -0
  112. data/lib/yoda/server/definition_provider.rb +36 -0
  113. data/lib/yoda/server/deserializer.rb +27 -0
  114. data/lib/yoda/server/hover_provider.rb +38 -0
  115. data/lib/yoda/server/signature_provider.rb +46 -0
  116. data/lib/yoda/store.rb +13 -0
  117. data/lib/yoda/store/actions.rb +10 -0
  118. data/lib/yoda/store/actions/import_core_library.rb +30 -0
  119. data/lib/yoda/store/actions/import_gems.rb +91 -0
  120. data/lib/yoda/store/actions/read_file.rb +36 -0
  121. data/lib/yoda/store/actions/read_project_files.rb +29 -0
  122. data/lib/yoda/store/adapters.rb +14 -0
  123. data/lib/yoda/store/adapters/base.rb +58 -0
  124. data/lib/yoda/store/adapters/leveldb_adapter.rb +80 -0
  125. data/lib/yoda/store/adapters/lmdb_adapter.rb +113 -0
  126. data/lib/yoda/store/objects.rb +46 -0
  127. data/lib/yoda/store/objects/addressable.rb +25 -0
  128. data/lib/yoda/store/objects/base.rb +116 -0
  129. data/lib/yoda/store/objects/class_object.rb +51 -0
  130. data/lib/yoda/store/objects/merger.rb +94 -0
  131. data/lib/yoda/store/objects/meta_class_object.rb +41 -0
  132. data/lib/yoda/store/objects/method_object.rb +94 -0
  133. data/lib/yoda/store/objects/module_object.rb +11 -0
  134. data/lib/yoda/store/objects/namespace_object.rb +67 -0
  135. data/lib/yoda/store/objects/overload.rb +51 -0
  136. data/lib/yoda/store/objects/patch.rb +46 -0
  137. data/lib/yoda/store/objects/patch_set.rb +80 -0
  138. data/lib/yoda/store/objects/tag.rb +62 -0
  139. data/lib/yoda/store/objects/value_object.rb +45 -0
  140. data/lib/yoda/store/project.rb +159 -0
  141. data/lib/yoda/store/query.rb +12 -0
  142. data/lib/yoda/store/query/associators.rb +10 -0
  143. data/lib/yoda/store/query/associators/associate_ancestors.rb +103 -0
  144. data/lib/yoda/store/query/associators/associate_methods.rb +38 -0
  145. data/lib/yoda/store/query/base.rb +16 -0
  146. data/lib/yoda/store/query/find_constant.rb +150 -0
  147. data/lib/yoda/store/query/find_meta_class.rb +18 -0
  148. data/lib/yoda/store/query/find_method.rb +74 -0
  149. data/lib/yoda/store/query/find_signature.rb +43 -0
  150. data/lib/yoda/store/registry.rb +67 -0
  151. data/lib/yoda/store/yard_importer.rb +260 -0
  152. data/lib/yoda/typing.rb +10 -0
  153. data/lib/yoda/typing/context.rb +96 -0
  154. data/lib/yoda/typing/environment.rb +35 -0
  155. data/lib/yoda/typing/evaluator.rb +256 -0
  156. data/lib/yoda/typing/lexical_scope.rb +26 -0
  157. data/lib/yoda/typing/relation.rb +15 -0
  158. data/lib/yoda/typing/traces.rb +9 -0
  159. data/lib/yoda/typing/traces/base.rb +26 -0
  160. data/lib/yoda/typing/traces/normal.rb +22 -0
  161. data/lib/yoda/typing/traces/send.rb +26 -0
  162. data/lib/yoda/version.rb +3 -0
  163. data/lib/yoda/yard_extensions.rb +11 -0
  164. data/lib/yoda/yard_extensions/sig_directive.rb +40 -0
  165. data/lib/yoda/yard_extensions/type_tag.rb +10 -0
  166. data/package.json +76 -0
  167. data/scripts/benchmark.rb +6 -0
  168. data/scripts/build_core_index.sh +16 -0
  169. data/yarn.lock +13 -0
  170. data/yoda-language-server.gemspec +40 -0
  171. metadata +424 -0
@@ -0,0 +1,113 @@
1
+ require 'lmdb'
2
+ require 'json'
3
+
4
+ module Yoda
5
+ module Store
6
+ module Adapters
7
+ class LmdbAdapter < Base
8
+ class << self
9
+ def for(path)
10
+ @pool ||= {}
11
+ @pool[path] || (@pool[path] = new(path))
12
+ end
13
+
14
+ def type
15
+ :lmdb
16
+ end
17
+ end
18
+
19
+ # @param path [String] represents the path to store db.
20
+ def initialize(path)
21
+ Dir.mkdir(path) unless Dir.exist?(path)
22
+ @path = path
23
+ @env = LMDB.new(path)
24
+ @db = @env.database('main', create: true)
25
+
26
+ at_exit { @env.close }
27
+ end
28
+
29
+ # @param address [String]
30
+ # @return [any]
31
+ def get(address)
32
+ JSON.load(@db.get(address.to_s), symbolize_names: true)
33
+ end
34
+
35
+ # @param data [Enumerator<(String, Object)>]
36
+ # @param bar [ProgressBar, nil]
37
+ def batch_write(data, bar)
38
+ env = LMDB.new(@path, mapsize: @env.info[:mapsize], writemap: true, mapasync: true, nosync: true)
39
+ db = env.database('main', create: true)
40
+ data.each do |(k, v)|
41
+ begin
42
+ db.put(k.to_s, v.to_json)
43
+ rescue LMDB::Error::MAP_FULL => _ex
44
+ @env.mapsize = @env.info[:mapsize] * 2
45
+ env.close
46
+ env = LMDB.new(@path, mapsize: @env.info[:mapsize], writemap: true, mapasync: true, nosync: true)
47
+ db = env.database('main', create: true)
48
+ db.put(k.to_s, v.to_json)
49
+ end
50
+ bar&.increment
51
+ end
52
+ env.close
53
+ end
54
+
55
+ # @param address [String]
56
+ # @param object [Object]
57
+ # @return [void]
58
+ def put(address, object)
59
+ do_put(address.to_s, object.to_json)
60
+ end
61
+
62
+ # @param address [String]
63
+ # @return [void]
64
+ def delete(address)
65
+ @db.delete(address.to_s)
66
+ end
67
+
68
+ # @param address [String]
69
+ # @return [true, false]
70
+ def exist?(address)
71
+ !!@db.get(address.to_s)
72
+ end
73
+
74
+ # @return [Array<String>]
75
+ def keys
76
+ Enumerator.new do |yielder|
77
+ @db.each { |(k, v)| yielder << k }
78
+ end.to_a
79
+ end
80
+
81
+ def stats
82
+ @db.stat
83
+ end
84
+
85
+ def clear
86
+ @db.clear
87
+ end
88
+
89
+ def sync
90
+ # @env.sync(force: true)
91
+ end
92
+
93
+ private
94
+
95
+ # @param address [String]
96
+ # @param value [String]
97
+ # @return [void]
98
+ def do_put(address, value)
99
+ LMDB.new(@path, mapsize: @env.info[:mapsize]) do |env|
100
+ db = env.database('main', create: true)
101
+ db.put(address, value)
102
+ end
103
+ rescue LMDB::Error::MAP_FULL => _ex
104
+ @env.mapsize = @env.info[:mapsize] * 2
105
+ LMDB.new(@path, mapsize: @env.info[:mapsize]) do |env|
106
+ db = env.database('main', create: true)
107
+ db.put(address, value)
108
+ end
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,46 @@
1
+ module Yoda
2
+ module Store
3
+ module Objects
4
+ VALUE_REGEXP = /\A[0-9a-z]/
5
+ MODULE_TAIL_PATTERN = /(?:::(\w+)|^(\w+))$/
6
+
7
+ require 'yoda/store/objects/base'
8
+ require 'yoda/store/objects/namespace_object'
9
+ require 'yoda/store/objects/class_object'
10
+ require 'yoda/store/objects/value_object'
11
+ require 'yoda/store/objects/overload'
12
+ require 'yoda/store/objects/meta_class_object'
13
+ require 'yoda/store/objects/method_object'
14
+ require 'yoda/store/objects/merger'
15
+ require 'yoda/store/objects/module_object'
16
+ require 'yoda/store/objects/patch'
17
+ require 'yoda/store/objects/patch_set'
18
+ require 'yoda/store/objects/tag'
19
+
20
+ class << self
21
+ # @param hsh [Hash]
22
+ # @param [Addressable, nil]
23
+ def deserialize(hsh)
24
+ case hsh[:type].to_sym
25
+ when :class
26
+ ClassObject.new(hsh)
27
+ when :module
28
+ ModuleObject.new(hsh)
29
+ when :meta_class
30
+ MetaClassObject.new(hsh)
31
+ when :value
32
+ ValueObject.new(hsh)
33
+ when :method
34
+ MethodObject.new(hsh)
35
+ end
36
+ end
37
+
38
+ # @param path [Model::Path, String]
39
+ # @return [Array<Path>]
40
+ def lexical_scopes_of(path)
41
+ Model::Path.build(path).parent_paths.map { |name| Model::Path.build(name) } + [Model::Path.new('Object')]
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,25 @@
1
+ module Yoda
2
+ module Store
3
+ module Objects
4
+ module Addressable
5
+ # @abstract
6
+ # @return [Symbol]
7
+ def kind
8
+ fail NotImplementedError
9
+ end
10
+
11
+ # @abstract
12
+ # @return [String]
13
+ def address
14
+ fail NotImplementedError
15
+ end
16
+
17
+ # @abstract
18
+ # @return [Hash]
19
+ def to_hash
20
+ fail NotImplementedError
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,116 @@
1
+ module Yoda
2
+ module Store
3
+ module Objects
4
+ # @abstract
5
+ class Base
6
+ class << self
7
+ def json_creatable?
8
+ true
9
+ end
10
+
11
+ # @param params [Hash]
12
+ def json_create(params)
13
+ new(params.map { |k, v| [k.to_sym, v] }.to_h)
14
+ end
15
+
16
+ # @return [Array<Symbol>]
17
+ def attr_names
18
+ %i(path document tag_list sources primary_source)
19
+ end
20
+ end
21
+
22
+ # @return [String]
23
+ attr_reader :path
24
+
25
+ # @return [String]
26
+ attr_reader :document
27
+
28
+ # @return [Array<Tag>]
29
+ attr_reader :tag_list
30
+
31
+ # @return [Array<(String, Integer, Integer)>]
32
+ attr_reader :sources
33
+
34
+ # @return [(String, Integer, Integer), nil]
35
+ attr_reader :primary_source
36
+
37
+ # @param path [String]
38
+ # @param document [String]
39
+ # @param tag_list [TagList, nil]
40
+ # @param sources [Array<(String, Integer, Integer)>]
41
+ # @param primary_source [(String, Integer, Integer), nil]
42
+ def initialize(path:, document: '', tag_list: [], sources: [], primary_source: nil, json_class: nil, kind: nil)
43
+ @path = path
44
+ @document = document
45
+ @tag_list = tag_list
46
+ @sources = sources
47
+ @primary_source = primary_source
48
+ end
49
+
50
+ # @return [String]
51
+ def name
52
+ fail NotImplementedError
53
+ end
54
+
55
+ # @return [Symbol]
56
+ def kind
57
+ fail NotImplementedError
58
+ end
59
+
60
+ # @return [String]
61
+ def address
62
+ path
63
+ end
64
+
65
+ # @return [Hash]
66
+ def to_h
67
+ {
68
+ kind: kind,
69
+ path: path,
70
+ document: document,
71
+ tag_list: tag_list,
72
+ sources: sources,
73
+ primary_source: primary_source
74
+ }
75
+ end
76
+
77
+ # @return [String]
78
+ def to_json
79
+ to_h.merge(json_class: self.class.name).to_json
80
+ end
81
+
82
+ # @param another [self]
83
+ # @return [self]
84
+ def merge(another)
85
+ self.class.new(merge_attributes(another))
86
+ end
87
+
88
+ def hash
89
+ ([self.class.name] + to_h.to_a).hash
90
+ end
91
+
92
+ def eql?(another)
93
+ self.class == another.class && to_h == another.to_h
94
+ end
95
+
96
+ def ==(another)
97
+ eql?(another)
98
+ end
99
+
100
+ private
101
+
102
+ # @param another [self]
103
+ # @return [Hash]
104
+ def merge_attributes(another)
105
+ {
106
+ path: path,
107
+ document: document + another.document,
108
+ tag_list: tag_list + another.tag_list,
109
+ sources: sources + another.sources,
110
+ primary_source: primary_source || another.primary_source,
111
+ }
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,51 @@
1
+ module Yoda
2
+ module Store
3
+ module Objects
4
+ class ClassObject < NamespaceObject
5
+ # @return [ScopedPath, nil]
6
+ attr_reader :superclass_path
7
+
8
+ # @return [Array<Symbol>]
9
+ def self.attr_names
10
+ super + %i(superclass_path)
11
+ end
12
+
13
+ # @param path [String]
14
+ # @param superclass_path [String, nil]
15
+ def initialize(superclass_path: nil, **kwargs)
16
+ super(kwargs)
17
+
18
+ @superclass_path = Model::ScopedPath.new(Objects.lexical_scopes_of(path), superclass_path) if superclass_path
19
+ end
20
+
21
+ def kind
22
+ :class
23
+ end
24
+
25
+ def to_h
26
+ super.merge(superclass_path: superclass_path&.path&.to_s)
27
+ end
28
+
29
+ private
30
+
31
+ # @param another [self]
32
+ # @return [Hash]
33
+ def merge_attributes(another)
34
+ super.merge(
35
+ superclass_path: select_superclass(another.superclass_path)&.path&.to_s,
36
+ )
37
+ end
38
+
39
+ # @param another [ScopedPath]
40
+ # @return [ScopedPath]
41
+ def select_superclass(another)
42
+ if %w(Object Exception).include?(another&.path&.to_s)
43
+ superclass_path || another
44
+ else
45
+ another || superclass_path
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,94 @@
1
+ module Yoda
2
+ module Store
3
+ module Objects
4
+ class Merger
5
+ # @return [Array<Base>]
6
+ attr_reader :instances
7
+
8
+ # @param instances [Array<Base>]
9
+ def initialize(instances)
10
+ @instances = instances
11
+ end
12
+
13
+ # @return [Base]
14
+ def merged_instance
15
+ class_to_generate.new(attributes.select { |k, v| class_to_generate.attr_names.include?(k) }.to_h)
16
+ end
17
+
18
+ private
19
+
20
+ # @return [Base.class]
21
+ def class_to_generate
22
+ @class_to_generate ||= begin
23
+ if instances.any? { |el| el.is_a?(MetaClassObject) }
24
+ MetaClassObject
25
+ elsif instances.any? { |el| el.is_a?(ClassObject) }
26
+ ClassObject
27
+ elsif instances.any? { |el| el.is_a?(ModuleObject) }
28
+ ModuleObject
29
+ elsif instances.any? { |el| el.is_a?(MethodObject) }
30
+ MethodObject
31
+ else
32
+ ValueObject
33
+ end
34
+ end
35
+ end
36
+
37
+ # @return [Hash{ Symbol => Object }]
38
+ def attributes
39
+ @attributes ||= instances.map { |i| default_attributes.merge(i.to_h) }.reduce { |a, b| merge_attributes(a, b) }
40
+ end
41
+
42
+ # @param one [Hash{ Symbol => Object }]
43
+ # @param another [Hash{ Symbol => Object }]
44
+ def merge_attributes(one, another)
45
+ {
46
+ path: one[:path] || another[:path],
47
+ document: one[:document] + (one[:document].empty? || another[:document].empty? ? '' : "\n") + another[:document],
48
+ tag_list: one[:tag_list] + another[:tag_list],
49
+ sources: one[:sources] + another[:sources],
50
+ primary_source: one[:primary_source] || another[:primary_source],
51
+ instance_method_addresses: one[:instance_method_addresses] + another[:instance_method_addresses],
52
+ mixin_addresses: one[:mixin_addresses] + another[:mixin_addresses],
53
+ constant_addresses: one[:constant_addresses] + another[:constant_addresses],
54
+ visibility: one[:visibility] || another[:visibility],
55
+ parameters: one[:parameters].empty? ? another[:parameters] : one[:parameters],
56
+ overloads: one[:overloads] + another[:overloads],
57
+ superclass_path: select_superclass(one, another),
58
+ value: one[:value] || another[:value],
59
+ }
60
+ end
61
+
62
+ # @return [Hash{ Symbol => Object }]
63
+ def default_attributes
64
+ {
65
+ path: nil,
66
+ document: '',
67
+ tag_list: [],
68
+ sources: [],
69
+ primary_source: nil,
70
+ instance_method_addresses: [],
71
+ mixin_addresses: [],
72
+ constant_addresses: [],
73
+ visibility: nil,
74
+ parameters: [],
75
+ overloads: [],
76
+ superclass_path: nil,
77
+ value: nil,
78
+ }
79
+ end
80
+
81
+ # @param one [Hash{ Symbol => Object }]
82
+ # @param another [Hash{ Symbol => Object }]
83
+ # @return [ScopedPath]
84
+ def select_superclass(one, another)
85
+ if %w(Object Exception).include?(another[:path].to_s)
86
+ one[:superclass_path] || another[:superclass_path]
87
+ else
88
+ another[:superclass_path] || one[:superclass_path]
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end