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,40 @@
1
+ module Yoda
2
+ module Parsing
3
+ module Query
4
+ class CurrentNodeCommentQuery
5
+ attr_reader :ast, :comments, :location
6
+
7
+ # @param ast [::Parser::AST::Node]
8
+ # @param comments [Array<::Parser::Source::Comment>]
9
+ # @param location [Location]
10
+ def initialize(comments, location)
11
+ @ast = ast
12
+ @comments = comments
13
+ @location = location
14
+ end
15
+
16
+ # @return [Array<::Parser::Source::Comment>]
17
+ def current_commenting_node
18
+ @current_commenting_node ||= inverse_association[current_comment_block]
19
+ end
20
+
21
+ private
22
+
23
+ # @return [{::Parser::AST::Node => Array<::Parser::Source::Comment>}]
24
+ def association
25
+ @association ||= ::Parser::Source::Comment.associate(ast, comments)
26
+ end
27
+
28
+ # @return [{Array<::Parser::Source::Comment> => ::Parser::AST::Node}]
29
+ def inverse_association
30
+ @inverse_association ||= association.invert
31
+ end
32
+
33
+ # @return [{::Parser::Source::Map => Array<::Parser::Source::Comment>]
34
+ def location_association
35
+ @location_association ||= ::Parser::Source::Comment.associate_with_location(ast, comments)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,41 @@
1
+ module Yoda
2
+ module Parsing
3
+ class Range
4
+ attr_reader :begin_location, :end_location
5
+ # @param begin_location [Integer]
6
+ # @param end_location [Integer]
7
+ def initialize(begin_location, end_location)
8
+ @begin_location = begin_location
9
+ @end_location = end_location
10
+ end
11
+
12
+ # @param ast_location [Parser::Source::Map, Parser::Source::Range]
13
+ # @return [Location, nil]
14
+ def self.of_ast_location(ast_location)
15
+ return nil unless Location.valid_location?(ast_location)
16
+ new(
17
+ Location.new(row: ast_location.line, column: ast_location.column),
18
+ Location.new(row: ast_location.last_line, column: ast_location.last_column),
19
+ )
20
+ end
21
+
22
+ # @return [{Symbol => { Symbol => Integer } }]
23
+ def to_language_server_protocol_range
24
+ { start: begin_location.to_language_server_protocol_range, end: end_location.to_language_server_protocol_range }
25
+ end
26
+
27
+ # @param row [Integer]
28
+ # @param column [Integer]
29
+ # @return [Range]
30
+ def move(row:, column:)
31
+ self.class.new(begin_location.move(row: row, column: column), end_location.move(row: row, column: column))
32
+ end
33
+
34
+ # @param location [Location]
35
+ # @return [true, false]
36
+ def include?(location)
37
+ begin_location <= location && location <= end_location
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,15 @@
1
+ module Yoda
2
+ module Parsing
3
+ module Scopes
4
+ require 'yoda/parsing/scopes/base'
5
+ require 'yoda/parsing/scopes/root'
6
+ require 'yoda/parsing/scopes/method_definition'
7
+ require 'yoda/parsing/scopes/module_definition'
8
+ require 'yoda/parsing/scopes/class_definition'
9
+ require 'yoda/parsing/scopes/meta_method_definition'
10
+ require 'yoda/parsing/scopes/meta_class_definition'
11
+
12
+ require 'yoda/parsing/scopes/builder'
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,78 @@
1
+ module Yoda
2
+ module Parsing
3
+ module Scopes
4
+ # Base class for wrapper classes of nodes which create lexical scopes.
5
+ # @abstract
6
+ class Base
7
+ # @return [::Parser::AST::Node]
8
+ attr_reader :node
9
+
10
+ # @return [Namespace, nil]
11
+ attr_reader :parent
12
+
13
+ # @return [Array<Base>]
14
+ attr_reader :child_scopes
15
+
16
+ # @return [Array<MethodDefinition>]
17
+ attr_reader :method_definitions
18
+
19
+ # @param node [::Parser::AST::Node]
20
+ # @param parent [Base, nil]
21
+ def initialize(node, parent = nil)
22
+ fail ArgumentError, node unless node.is_a?(::Parser::AST::Node)
23
+ fail ArgumentError, parent if parent && !parent.is_a?(Base)
24
+ @node = node
25
+ @parent = parent
26
+ @method_definitions = []
27
+ @child_scopes = []
28
+ end
29
+
30
+ # @abstract
31
+ # @return [Array<::Parser::AST::Node>]
32
+ def body_nodes
33
+ fail NotImplementedError
34
+ end
35
+
36
+ # @abstract
37
+ # @return [::Parser::AST::Node]
38
+ def body_node
39
+ fail NotImplementedError
40
+ end
41
+
42
+ # @param location [Location]
43
+ # @return [true, false]
44
+ def inner_location?(location)
45
+ location.included?(node.location)
46
+ end
47
+
48
+ # @abstract
49
+ # @return [Symbol]
50
+ def kind
51
+ fail NotImplementedError
52
+ end
53
+
54
+ # @return [true, false]
55
+ def method?
56
+ false
57
+ end
58
+
59
+ # @param current_location [Location]
60
+ # @return [Namespace, nil]
61
+ def find_evaluation_root_scope(current_location)
62
+ return nil unless inner_location?(current_location)
63
+ [*child_scopes, *method_definitions].each do |s|
64
+ if scope = s.find_evaluation_root_scope(current_location)
65
+ return scope
66
+ end
67
+ end
68
+ return self
69
+ end
70
+
71
+ # @return [Array<String>]
72
+ def ancestor_scopes
73
+ [scope_name, *(parent ? parent.ancestor_scopes : [])]
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,60 @@
1
+ module Yoda
2
+ module Parsing
3
+ module Scopes
4
+ class Builder
5
+ # @return [AST::Node]
6
+ attr_reader :node
7
+
8
+ # @param node [AST::Node]
9
+ def initialize(node)
10
+ @node = node
11
+ @root_scope = Root.new(node)
12
+ end
13
+
14
+ # @return [Scope]
15
+ def root_scope
16
+ unless @did_build
17
+ @did_build = true
18
+ build(node, @root_scope)
19
+ end
20
+ @root_scope
21
+ end
22
+
23
+ # @param node [AST::Node]
24
+ # @param scope [Base]
25
+ # @return [void]
26
+ def build(node, scope)
27
+ return if !node || !node.is_a?(AST::Node)
28
+ case node.type
29
+ when :def
30
+ mscope = MethodDefinition.new(node, scope)
31
+ scope.method_definitions << mscope
32
+ mscope.body_nodes.each { |node| build(node, mscope)}
33
+ when :defs
34
+ mscope = SingletonMethodDefinition.new(node, scope)
35
+ scope.method_definitions << mscope
36
+ mscope.body_nodes.each { |node| build(node, mscope)}
37
+ when :class
38
+ cscope = ClassDefinition.new(node, scope)
39
+ scope.child_scopes << cscope
40
+ cscope.body_nodes.each { |node| build(node, cscope)}
41
+ when :sclass
42
+ cscope = SingletonClassDefinition.new(node, scope)
43
+ scope.child_scopes << cscope
44
+ cscope.body_nodes.each { |node| build(node, cscope)}
45
+ when :module
46
+ mscope = ModuleDefinition.new(node, scope)
47
+ scope.child_scopes << mscope
48
+ mscope.body_nodes.each { |node| build(node, mscope)}
49
+ when :begin, :kwbegin, :block
50
+ node.children.each { |node| build(node, scope) }
51
+ else
52
+ if node.respond_to?(:children)
53
+ node.children.map { |node| build(node, scope) }
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,47 @@
1
+ module Yoda
2
+ module Parsing
3
+ module Scopes
4
+ # Wrapper class for class node.
5
+ # @see https://github.com/whitequark/parser/blob/2.2/doc/AST_FORMAT.md#class
6
+ # ```
7
+ # (class (const nil :Foo) (const nil :Bar) (nil))
8
+ # "class Foo < Bar; end"
9
+ # ~~~~~ keyword ~~~ end
10
+ # ~ operator
11
+ # ~~~~~~~~~~~~~~~~~~~~ expression
12
+ #
13
+ # (class (const nil :Foo) nil (nil))
14
+ # "class Foo; end"
15
+ # ~~~~~ keyword
16
+ # ~~~ end
17
+ # ~~~~~~~~~~~~~~ expression
18
+ # ```
19
+ class ClassDefinition < Base
20
+ def const_node
21
+ @const_node ||= NodeObjects::ConstNode.new(node.children[0])
22
+ end
23
+
24
+ def superclass_const_node
25
+ @superclass_const_node ||= node.children && NodeObjects::ConstNode.new(node.children[1])
26
+ end
27
+
28
+ def body_nodes
29
+ [body_node]
30
+ end
31
+
32
+ def body_node
33
+ node.children.last
34
+ end
35
+
36
+ def kind
37
+ :class
38
+ end
39
+
40
+ # @return [String]
41
+ def scope_name
42
+ const_node.to_s(parent.scope_name)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,44 @@
1
+ module Yoda
2
+ module Parsing
3
+ module Scopes
4
+ # Wrapper class for singleton class node.
5
+ # @see https://github.com/whitequark/parser/blob/2.2/doc/AST_FORMAT.md#singleton-class
6
+ # ```
7
+ # (sclass (lvar :a) (nil))
8
+ # "class << a; end"
9
+ # ~~~~~ keyword
10
+ # ~~ operator
11
+ # ~~~ end
12
+ # ~~~~~~~~~~~~~~~ expression
13
+ # ```
14
+ class SingletonClassDefinition < Base
15
+ def instance_node
16
+ node.children[0]
17
+ end
18
+
19
+ def body_nodes
20
+ [body_node]
21
+ end
22
+
23
+ def body_node
24
+ node.children.last
25
+ end
26
+
27
+ def kind
28
+ :meta_class
29
+ end
30
+
31
+ # @return [String]
32
+ def scope_name
33
+ const_node.to_s(parent.scope_name)
34
+ end
35
+
36
+ # @param current_location [Location]
37
+ # @return [Namespace, nil]
38
+ def find_evaluation_root_scope(current_location)
39
+ return nil
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,70 @@
1
+ module Yoda
2
+ module Parsing
3
+ module Scopes
4
+ # Wrapper class for singleton method node.
5
+ # @see https://github.com/whitequark/parser/blob/2.2/doc/AST_FORMAT.md#singleton-methods
6
+ # ```
7
+ # (defs (self) :foo (args) nil)
8
+ # "def self.foo; end"
9
+ # ~~~ keyword
10
+ # ~~~ name
11
+ # ~~~ end
12
+ # ~~~~~~~~~~~~~~~~~ expression
13
+ # ```
14
+ class SingletonMethodDefinition < Base
15
+ # @return [Symbol]
16
+ def name
17
+ node.children[1]
18
+ end
19
+
20
+ # @return [Parser::AST::Node]
21
+ def arg_node
22
+ node.children[2]
23
+ end
24
+
25
+ # @return [Parser::AST::Node]
26
+ def body_node
27
+ node.children[3]
28
+ end
29
+
30
+ # @return [Array<Parser::AST::Node>]
31
+ def body_nodes
32
+ [body_node]
33
+ end
34
+
35
+ def body_node
36
+ node.children[3]
37
+ end
38
+
39
+ # @return [String]
40
+ def full_name
41
+ "#{namespace.full_name}##{name}"
42
+ end
43
+
44
+ # @return [String]
45
+ def namespace_name
46
+ namespace.full_name
47
+ end
48
+
49
+ def kind
50
+ :meta_method
51
+ end
52
+
53
+ def method?
54
+ true
55
+ end
56
+
57
+ # @return [String]
58
+ def scope_name
59
+ parent.scope_name
60
+ end
61
+
62
+ # @param current_location [Location]
63
+ # @return [Namespace, nil]
64
+ def find_evaluation_root_scope(current_location)
65
+ return nil
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,69 @@
1
+ module Yoda
2
+ module Parsing
3
+ module Scopes
4
+ # Wrapper class for instance method node.
5
+ # @see https://github.com/whitequark/parser/blob/2.2/doc/AST_FORMAT.md#instance-methods
6
+ # ```
7
+ # (def :foo (args) nil)
8
+ # "def foo; end"
9
+ # ~~~ keyword
10
+ # ~~~ name
11
+ # ~~~ end
12
+ # ~~~~~~~~~~~~ expression
13
+ # ```
14
+ class MethodDefinition < Base
15
+ # @return [Symbol]
16
+ def name
17
+ node.children[0]
18
+ end
19
+
20
+ # @return [Parser::AST::Node]
21
+ def arg_node
22
+ node.children[1]
23
+ end
24
+
25
+ # @return [Parser::AST::Node]
26
+ def body_node
27
+ node.children[2]
28
+ end
29
+
30
+ # @return [Array<Parser::AST::Node>]
31
+ def body_nodes
32
+ [body_node]
33
+ end
34
+
35
+ # @return [String]
36
+ def full_name
37
+ "#{namespace.full_name}##{name}"
38
+ end
39
+
40
+ # @return [String]
41
+ def namespace_name
42
+ namespace.full_name
43
+ end
44
+
45
+ def singleton?
46
+ false
47
+ end
48
+
49
+ def kind
50
+ :method
51
+ end
52
+
53
+ def method?
54
+ true
55
+ end
56
+
57
+ # @return [String]
58
+ def scope_name
59
+ parent.scope_name
60
+ end
61
+
62
+ # @return [Array<String>]
63
+ def ancestor_scopes
64
+ parent.ancestor_scopes
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end