Find references to string/symbol/method

妖精的绣舞 提交于 2019-12-11 08:46:08

问题


This relates to the Dolphin variant of Smalltalk.

I'm digging around in the image to try and figure this out but haven't find the correct method invocation yet and I'm hoping someone might be able to help shortcut this process. What I'm trying to do is to find all methods (either within the entire system or, preferably, just within a single class) which refer to a given string, symbol, or method. I've found the #references family of methods in SmalltalkSystem but have not had luck figuring out how to get them to give back something resembling what I want.


回答1:


The programmatic way, here we go

SmalltalkSystem current browseContainingText: 'Dolphin'.



回答2:


I don't have Dolphin at hand, but the following code should work in all Smalltalk with the refactoring engine (this includes Dolphin):

result := BrowserEnvironment new matches: 'Dolphin'.

Then you can iterate over the results like this:

result classesAndSelectorsDo: [ :class :selector | ... ].


来源:https://stackoverflow.com/questions/1885196/find-references-to-string-symbol-method

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!