Project

General

Profile

Bug #160

Multiple line code with variable type casting mistaken for variable declaration

Added by Wil van Antwerpen over 5 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Start date:
07/12/2019
Due date:
% Done:

0%


Description

Reported by Jose:
https://support.dataaccess.com/Forums/showthread.php?64611-DFRefactor-20190426-Unused-local-variables-function-deletes-table-field

I have tried Unused local variables function on our biggest project and it doesn't compile after that.

Suppose something like this:

Procedure MyProcedure
    String sVarN1

    Gosub MySubProcedure

    MySubProcedure:
        Move ((Trim(Table.FieldN1)) + " / " + (Trim(Table.FieldN2)) + " / " + ;
            String (Table.FieldN3) + " / " + String (Table.FieldN4)) to sVarN1
End_Procedure

It gets refactored to (pay attention to Table.FieldN3 & Table.FieldN4 & parenthesis closing):

Procedure MyProcedure

    Gosub MySubProcedure

    MySubProcedure:
        Move ((Trim(Table.FieldN1)) + " / " + (Trim(Table.FieldN2)) + " / " + ;
            String + " / " + String to sVarN1

This is because the line
~~~
String (Table.FieldN3) + " / " + String (Table.FieldN4)) to sVarN1
~~~
is mistaken by our parser as a line of code with variable declaration while it is not.

Also available in: Atom PDF