DavidFeldhoff / al-codeactions

MIT License
17 stars 8 forks source link

Extract to procedure with an if one-liner #97

Closed DavidFeldhoff closed 3 years ago

DavidFeldhoff commented 3 years ago

If I try to extract a one-liner directly below an if true then, then the program thinks it's inside the if statement as the begin..end block is missing, so it thinks it should return a boolean parameter, so the extraction of the case statement here

if true then
  case Integer of
    1: //dosomething
    2:
  end;

leads to

procedure Test()
begin
  if true then
    newProcedure();
end;

local procedure newProcedure() resultValue: Boolean
begin
  resultValue := case Integer of
    1: //dosomething
    2:
  end;
end;