introspection - Eiffel:如何获取过程的特定操作数的类型
问题描述
正如我在调试器中看到的那样,可以获取操作数和过程名称,有没有办法获取它?
- PROCEDURE=>operands 返回一个可分离的,似乎仅在将操作数设置到代理中时才返回它们
- 我是否通过了任何 REFLECTOR 类,因为 PROCEDURE 类没有此功能,在这种情况下为什么呢?
似乎 estudio 可以访问 ROUTINE 客户端所没有的信息,为什么他是特权者?他在作弊吗?
解决方案
以下代码演示了如何检索有关例程对象的开放参数类型的信息:
p: ROUTINE -- Routine object.
t: TYPE [detachable ANY] -- Current open argument type.
do
p := agent (i: INTEGER; s: STRING)
do
end
across
1 |..| p.open_count as i
loop
t := p.generating_type.generic_parameter_type (1).generic_parameter_type (i.item)
io.put_string (t.name)
io.put_new_line
end
对我来说,上面的代码打印
INTEGER_32
!STRING_8
注释:
p.open_count
给出开放参数的总数.p.generating_type
检索例程对象的类型。p.generating_type.generic_parameter_type (1)
检索开放参数元组对象的类型。- 最终调用
generating_type
检索带有 index 的打开参数的类型i.item
。
推荐阅读
- c# - 实体框架在两个不同的上下文中插入实体两次
- c++ - C++ 中缀到后缀转换和计算器
- datepicker - Flutter DatePicker 没有一天
- sql-server - 如何根据不同的列值更新 SQL Server 表
- r - 将 Group by 和 Slope 与 dplyr 一起使用以获取新列
- ios - 为什么我得到不同的结果取决于我在模拟器中使用的是 iPad 还是 iPhone?
- ansible - 超出重试次数时从 async_status 循环中获取有意义的错误消息
- java - 为在 Tomcat 服务器上运行的 java 网站创建 ssl 证书
- javascript - 如何在 Node.js 中获取 URL 参数的值?
- apache - Apache2 升级后无法使用 SSL