the second definition has a wrong name: its line number
only the second one has proper access (and is not found by the test)
The second problem is relatively easy to fix: when handling private_class_method etc, handle the case where args[1] doesn't start with a :def symbol. In that case, args contains a list of method names to make private, so we can emit tags accordingly.
This won't fix the other problems, though. What should happen for line 3 is: update access on existing tag for method foo to private, in effect merging the two existing definitions.
Discovered this because my tagfile contained a number of entries that were just numbers. Each of them matched the location of an access modifier line that listed the symbol.
Consider this failing test:
and its console output (from
pp tags
, compacted slightly):Problems:
foo
is defined twice: on lines 2 and 3The second problem is relatively easy to fix: when handling
private_class_method
etc, handle the case whereargs[1]
doesn't start with a:def
symbol. In that case, args contains a list of method names to make private, so we can emit tags accordingly.This won't fix the other problems, though. What should happen for line 3 is: update access on existing tag for method foo to private, in effect merging the two existing definitions.