Skip to content

Commit a25902b

Browse files
committed
Localize visitor method docs to their effects
Say what the method does, versus saying why we're using it
1 parent 4187145 commit a25902b

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

lib/syntax_suggest/visitor.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ def consecutive_lines
3838
@consecutive_lines.keys.sort
3939
end
4040

41-
# Record lines where a method call is logically connected
42-
# to subsequent lines. This is the case when a method call
43-
# is broken up by a newline
41+
# Called by Prism::Visitor for every method-call node in the AST
42+
# (e.g. `foo.bar`, `foo.bar.baz`).
4443
def visit_call_node(node)
4544
receiver_loc = node.receiver&.location
4645
call_operator_loc = node.call_operator_loc
@@ -65,10 +64,10 @@ def visit_call_node(node)
6564
super
6665
end
6766

68-
# Endless method definitions like `def foo = 123` are valid without
69-
# an `end` keyword. We record their keyword here so that we can later
70-
# skip considering them for keywords since they have no coresponding
71-
# end
67+
# Called by Prism::Visitor for every `def` node in the AST.
68+
# Records the keyword location for endless method definitions
69+
# like `def foo = 123`. These are valid without a matching `end`,
70+
# so Token must exclude them when deciding if a line is a keyword.
7271
def visit_def_node(node)
7372
@endless_def_keyword_locs << node.def_keyword_loc if node.equal_loc
7473
super

0 commit comments

Comments
 (0)