Given a piece of code like this:
var anEnumVariable: TMyEnum;
begin
...
case anEnumVariable of
{$IFDEF SOMETHING}
enumFirst:
{$ELSE}
enumSecond :
{$ENDIF}
begin
end;
Current JCF turns it into this:
case anEnumVariable of
{$IFDEF SOMETHING}
enumFirst:
{$ELSE}
begin
end;
{$ENDIF}
Which doesn't compile. And I have hundreds of these to patch up. I realise it's not ideal coding, but that's what the legacy code I'm faced with has.
Among other problems, not least the D2010 formatted adding a lot of linebreaks in almost random places, which I'd like JCF to remove for me.
I'm going to have a go at building the JCF so I can add a "only remove single line begin-end pairs from case statements" option (and BTW the "remove single statement begin-end pairs might benefit from an "except multiline single statements" so it does not strip them from "if then begin for begin" type statements). The other programmers like their single line ones, but in a case statement it becomes ugly:
case Foo of
this: Something();
that: OtherThing();
end;
is much nicer than
case Foo of
this:
begin
Something();
end;
that:
begin
OtherThing();
end;
end;
but we have a lot of the latter. Especially, we have a lot of 10+ label versions, and 40+ lines per instance is a lot.