Thanks Michael,
That is the correct question.
Normally DfRefactor only removes unused variables within a method, so it is a strange problem to see.
If you declare a struct within a method then that would certainly confuse DfRefactor.
I had to test it, but this does indeed compile:
Code:
Use Windows.pkg
Procedure Test
Struct tEmbArray
String sEmbTyp
Integer iUtlan
Integer iReturnerad
End_Struct
tEmbArray[] EmbSaldo
Move (ResizeArray(EmbSaldo,1)) To EmbSaldo
Move 1 To EmbSaldo[0].iUtlan
Showln "Hello"
End_Procedure
Send test
inKey WindowIndex
If you run DfRefactor on the above then it does indeed show the result that Bengt mentions.
If I then rerun it, but move the struct declaration out of the method:
Code:
Use Windows.pkg
Struct tEmbArray
String sEmbTyp
Integer iUtlan
Integer iReturnerad
End_Struct
Procedure Test
tEmbArray[] EmbSaldo
Move (ResizeArray(EmbSaldo,1)) To EmbSaldo
Move 1 To EmbSaldo[0].iUtlan
Showln "Hello"
End_Procedure
Send test
inKey WindowIndex
Then it works as expected and it does not remove the variables from the struct declaration.
So in this scenario, unless you can provide a better example, I'd say "not a bug" as it points out a very non standard thing in your code.
--
Wil