如何在 Squeak 中检索方法的签名

发布于 2024-09-01 01:19:58 字数 318 浏览 1 评论 0原文

printThisMethodSig: aSomething
stack := thisContext stackOfSize: 2.
Transcript show: (stack at: 2); cr.

stack at: 2 返回当前方法的方法上下文。可以使用 method 消息检索当前方法的编译方法。我希望能够打印该方法的整个签名,例如:from:to:。 我查看了 MethodContext 和 CompiledMethod 类,但不知道如何做到这一点。

谢谢。

printThisMethodSig: aSomething
stack := thisContext stackOfSize: 2.
Transcript show: (stack at: 2); cr.

stack at: 2 returns the method context of the current method. It is possible to retrieve the compiled method of the current method using method message. I want to be able to print the whole signature of the method, for example: from:to:.
I looked at both MethodContext and CompiledMethod classes but could not find out how to do it.

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

场罚期间 2024-09-08 01:19:59

您可以使用selector消息来检索CompiledMethod的名称。

You can use the selector message to retrieve the name of a CompiledMethod.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文