This project is read-only.
1

Resolved

Renaming a unit must change uses clauses

description

Renaming a unit must change uses clauses in the .DPR and other .PAS files. Changing of the name of a unit in the .DPR is a feature of Delphi IDE however changing them in all of the projects .PAS files is a new feature that I think people will like.
 
This will ignore compiler directives and rename all occurrences of the old name with the new name in all "Uses" clauses up to the first semicolon (;) found.
 
For example renaming the file Unit1 to MYDATA will change both uses clauses of the following code....
 
{$IFDEFINED test}
uses CUnit, unit1;
{$ELSE}
uses AUnit, unit1;
{$ENDIF}
 
However the it will not change the following...
 
uses AUnit,
{$IFDEFINED test}
CUnit;
{$ELSE}
unit1;
{$ENDIF}
 
The reason for this is because the first semicolon that ends the uses clause comes before the Unit1 identifier. After the semicolon the parser will then look for next "uses" keyword and in the above example it will find only a comment then an identifier as the directives are ignored.

comments

wrote Jun 22, 2007 at 3:07 AM

Resolved with changeset 6489.

Davincij wrote May 24, 2008 at 5:32 PM

** Closed by Davincij 6/21/2007 7:07 PM

Davincij wrote May 24, 2008 at 5:32 PM

wrote May 24, 2008 at 5:32 PM

wrote Feb 14, 2013 at 1:06 AM

wrote May 16, 2013 at 7:18 AM

wrote May 16, 2013 at 7:18 AM

wrote Jun 14, 2013 at 9:00 AM