Ruby scanner has problems to recognize method names in more complex forms of singleton method definition.
I have made a test case.
# simple method definitionsdefmethodparam1,param2# codeenddefmethod(args, *rest, &block)# codeenddefmethod(param1,param2)# codeenddef \
method(param1,param2)# codeenddef# commentmethod(param1,param2)# codeenddef [];enddefdef;enddefend?;enddefa(*)enddef !;end# Ruby 1.9# singleton methodsdefClass.methodenddefself.methodenddefobject.methodenddef $~.methodenddefnil.methodenddeftrue.methodenddeffalse.methodenddef__FILE__.methodenddef__LINE__.methodenddef__ENCODING__.methodenddef__ENCODING__.methodenddef@instance_variable.methodenddef@class_variable.methodenddef(Module::Class).methodenddef(complex.expression).methodenddef(complex.expression + another(complex(expression))).methodend# crazydef(classFoodefinitialize(args)defyet_another_method;endendend).method(args, *rest, &block)end# wrongdeffoo.bar.quuxend
The simple cases are working now. Support for def (expression).method is still missing, but possible now that the state handling has been cleaned up.
I just realized we can even have recursive expression singleton method declarations - so the parenthesis nesting depth really has to be saved in the state, not in a local variable.
I still want to get this obscure thing working, but it's not as important as other features in 1.0. So, I postpone the rest of this ticket to 1.1.
From Redmine: http://odd-eyed-code.org/issues/147
From Redmine: http://odd-eyed-code.org/issues/147