简体   繁体   中英

Eiffel: how do I get the type of a particular operand of a procedure

As I can see into the debugger it's possible to get the operands, and name of procedure, is there a way to get it?

  • PROCEDURE=>operands returns a detachable that seems return the operands only when they have been setted into the agent
  • Do I have pass through any REFLECTOR class because the PROCEDURE class doesn't have this function and in this case why?

在此处输入图片说明

Seems that estudio has access to informations as ROUTINE client don't have, why is he a privileged one? is he cheating?

The following code demonstrates how to retrieve information about open argument types of a routine object:

        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

For me, the code above prints

INTEGER_32
!STRING_8

Comments:

  1. p.open_count gives the total number of open arguments.
  2. p.generating_type retrieves the type of the routine object.
  3. p.generating_type.generic_parameter_type (1) retrieves the type of the open arguments tuple object.
  4. The final call to generating_type retrieves the type of the open argument with index i.item .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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