Skip to content

Commit 4605e17

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

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
@@ -39,9 +39,8 @@ def consecutive_lines
3939
@consecutive_lines.keys.sort
4040
end
4141

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

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

0 commit comments

Comments
 (0)