Project

General

Profile

Bug #107

Reindent on conditional looping statement wrong.

Added by Wil van Antwerpen over 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
04/14/2018
Due date:
% Done:

0%


Description

The following code is valid DataFlex code:

Integer iTemp
If (iTemp) Begin
For iTemp From 1 To 1
Repeat
Showln 'something'
While (iTemp)
Showln 'something something else'
If (iTemp) Repeat
Showln 'something something else again'
Until (iTemp)
Loop
Until (iTemp)
Loop
End

It will end up like the above when you try to use re-indent on it.

The problem is that the "repeat" statement is not expected to be conditional.
Personally I would rewrite this into:

If (iTemp) Begin
For iTemp From 1 To 1
Repeat
Showln 'something'
While (iTemp)
Showln 'something something else'
If (iTemp) Begin
Repeat
Showln 'something something else again'
Until (iTemp)
End
Loop
Until (iTemp)
Loop
End

But regardless, the first version IS valid code.

As the re-indent logic piggy backs on code collapse logic, it is likely to be a problem down there too.

Also available in: Atom PDF