简体   繁体   English

在Pharo中获取所有已安装方法的正确方法

[英]Proper way to get all installed methods in Pharo

Sometimes you want to analyze all the methods in the image. 有时您想分析图像中的所有方法。 One way to do this is to work with CompiledMethod allInstances . 一种方法是使用CompiledMethod allInstances But it is dangerous to do it this way, as 但是这样做很危险,因为

  1. You may end up with old methods that were not garbage-collected yet. 您可能会遇到尚未被垃圾回收的旧方法。
  2. There may be compiled methods of anonymous classes or other instances that are there for technical reasons. 出于技术原因,可能存在匿名类或其他实例的已编译方法。

A dialect independent expression would be 方言无关的表达是

ProtoObject withAllSubclasses gather: [:cls |
  cls methodDictionary values asArray,
    cls class methodDictionary values asArray]

我想到的一件事是:

RPackage organizer packages flatCollect: #methods 

我建议使用SystemNavigation ,它是为此设计的类:

SystemNavigation default allMethodsSelect: [:m | true]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM