Fire fix Out var etc

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… :slight_smile:
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.

is that with latest beta? iirc we fixed, that, @ck?

you can disable all of these in Preferences. but really, if they are misbehaving, we need to fix THAT.

Yes it is the latest beta but also 9.2
You should try to use legacy code in Fire and you will see :wink:

can you give me a full com;piliong test-case that shows this?

here is a test case. Try to Build it…
Test.zip (4.1 KB)

Thanks, logged as bugs://78559

bugs://78559 got closed with status fixed.

Sorry to tell, but this is not complete fixed:

I have functions like

method ClearEvent(Var Value : &Event);

Original Source:

ClearEvent(&Event);

will become this after the Fix:
ClearEvent(&var Event); // Look at the &var

Another Problem also:

if inside the method is a call to

method ClearEvent(Var Value : &Event);
begin
inherited; // Here
... 
end;

the Result:

method ClearEvent(Var Value : &Event);
begin
var inherited; // Here a Var before inherited
... 
end;

hmm. that sounds like a completely different bug. can you give a complete test case that shows this?

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.

Thanks, logged as bugs://78668

Yeah,

      inherited; // E208 Modifier mismatch for parameter 1, expected "var" but found "in"

should not generate an error to begin with, let alone a fix-it :stuck_out_tongue_winking_eye:

1 Like

bugs://78668 got closed with status fixed.