Menu

#229 "remove WITH" refactoring

open
None
5
2026-05-06
2026-05-06
No

It would be really nice to have some kind of semi-automatic refactoring for WITH statements.

  1. If the tool can determine the variable type and the fields that belong to it, it should simple prefix these fields.
  2. Alternatively it could simply prefix all identifiers with the variable and let the compiler/user figure out which ones to remove. That at least is much simpler than manually adding the prefixes everywhere.
with bla do begin
  Left := 5;
  Right := self.Right;
  Parent := nil;
end;

would then become

bla.Left := 5;
bla.Right := Self.Right;
bla.Parent := nil;

Even though bla might not have a Parent field so the code does not compile.

Of course that still does not solve with with multiple identifiers:

with bla, blub do begin
end;

Discussion


Log in to post a comment.

MongoDB Logo MongoDB