Incorrect behavior / error in delphi2010 "extraction method"

I have to deal with this problem when I try to extract a method in an if statement. I could not find the registered error.

procedure TForm1.BitBtn3Click(Sender: TObject); var x: integer; b: boolean; begin if true then x := 8 //********************** i try to extract this line else x := 6; showmessage(inttostr(x)); end; 

The result I get:

 procedure TForm1.BitBtn3Click(Sender: TObject); var x: integer; b: boolean; begin if true then newMethode else x := 6; showmessage(inttostr(x)); end; 

and the new method:

 procedure TForm1.newMethode; var x: Integer; begin x := 8; end; 

Can anyone check how this happens on Delphi XE? Does anyone know if this has been reported?

+7
source share
2 answers

This is a bug in the Extract Method refactoring.

As an alternative, you may need to “Extract Method” refactoring from the ModelMaker Code Explorer tool. In EUR 99, this is a relatively cheap tool that works further from Delphi 5, and the latest updates 9.0.5 significantly improved the refactoring of the extraction method, so I did not use the built-in Delphi for a long time.

Two big advantages:

  • it launches a method editor dialog where you can change and modify parameters, which are then reflected in the extracted and calling codes
  • it leaves the source code in a comment (* *) only if something fails, or you need to reference it

In addition, it places bookmarks (numbered 7, 8, and 9) in the code for convenient navigation between the extracted code and the call site.

Highly recommended.

+4
source

You Can Find Your Answer About Retrieving the Oracle Blog Entry Method

0
source

All Articles