Working with legacy code in Fire makes a lot of problems actual:
If the E208 is checked on for fix out var etc. and in the Options of Fire it is enabled to
i got some wired result:
Original Code:
method TcadLayer.HandleEvent(var &event: TEvent);
begin
if &event.eventType <> tEventType.evnothing then
inherited;
if (not fselectall) then
if &event.eventType = tEventType.evCommand then
case &event.Command of
cmLINE:
begin
Fillevent(&event, cmMakeLine);
Events.setEvent(&event);
ClearEvent(&event);
end;
…
becomes:
method TcadLayer.HandleEvent(var &event: TEvent);
begin
if &event.eventType <> tEventType.evnothing then
varinherited; //Why varinherited?
if (not fselectall) then
if &event.eventType = tEventType.evCommand then
case &event.Command of
cmLINE:
begin
Fillevent(&varevent, cmMakeLine); // varevent
Events.setEvent(&event);
ClearEvent(&varevent); // etc
end;
There is always a missing Blank after var and out.
Also Fire is often to smart…
We need a option to disable more of the automated fixes. Like add namespaces, add missing methods to Interface / Implementation.
If working with new code it is nice, but in the process of change legacy code to Elements there are problems.
Fire is great, there are only some glitches that should be addressed.
namespace test;
type
Tbase = class
public
method test(var &event : Integer); virtual; empty;
end;
TChild = class(Tbase)
public
method test(var &event : Integer); override;
begin
inherited;
end;
end;
Program = public static class
public
method Main(aArguments: array of String): Int32;
begin
writeLn('The magic happens here.');
var T := new TChild;
var &Event : Integer;
T.test(&Event);
end;
end;
end.
Try to compile…
You will get:
namespace test;
type
Tbase = class
public
method test(var &event : Integer); virtual; empty;
end;
TChild = class(Tbase)
public
method test(var &event : Integer); override;
begin
var inherited; // here
end;
end;
Program = public static class
public
method Main(aArguments: array of String): Int32;
begin
writeLn('The magic happens here.');
var T := new TChild;
var &Event : Integer;
T.test(&var Event); // And here
end;
end;
end.