rusty icon indicating copy to clipboard operation
rusty copied to clipboard

Resolving local inline enum variants requires linear search and substring-comparisons

Open riederm opened this issue 11 months ago • 0 comments

Resolving inline enum variants is unnecessarily complex since they are unfavorably stored in the index.

FUNCTION main : DINT
  VAR
      variant1 : (x := 1, y := 2) := x;
  END_VAR
  
END_FUNCTION

We should pre-process this code into:

TYPE __main_enum_1 : (x := 1 ,y := 2) INT
END_TYPE

FUNCTION main : DINT
  VAR
      variant1 : __main_enum_1 := __main_enum_1#x;
  END_VAR
  
END_FUNCTION

This way, we can resolve inline enums the same way.

riederm avatar Feb 29 '24 20:02 riederm