Skip to content

[QUESTION] Acquiring variables in VAR_OUTPUT section in method declaration #92

@Specter-13

Description

@Specter-13

Hello,
I would like to acquire output variables of method.

I have following plc code sample:

CLASS MyTestClass

    VAR PUBLIC
      myINT : INT ;
    END_VAR

 METHOD PUBLIC MyMethod : INT

        VAR_INPUT
            varin1 : INT;
            varin2 : INT;
        END_VAR

        myINT := varin1;

        VAR_OUTPUT
            varout1 : INT;
            varout2 : INT;
        END_VAR

    END_METHOD

END_CLASS

For input variables I'm using following code which is working just fine:

var inputVars = methodDeclaration.Variables.Where(v => v.Section == Section.Input);

where methodDeclaration is type of IMethodDeclaration from AX semantic model.

However, for output variables following code doesn't work:

var outputVars = methodDeclaration.Variables.Where(v => v.Section == Section.Output);

I would expect to get a list of variables in VAR_OUTPUT, but I've got an empty list.

Am I missing something or is there a different way to acquire output variables?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions