Converter: FindUnitCaseInsensitive is fixed, remove workaround. Leave a local FindMissingUnits for better control.

git-svn-id: trunk@28931 -
This commit is contained in:
juha 2011-01-10 11:17:57 +00:00
parent 8b63e9a07b
commit ca4fb99240
3 changed files with 1 additions and 20 deletions

View File

@ -58,8 +58,6 @@ type
fIsConsoleApp: Boolean; fIsConsoleApp: Boolean;
fAskAboutError: Boolean; fAskAboutError: Boolean;
fSettings: TConvertSettings; // Conversion settings. fSettings: TConvertSettings; // Conversion settings.
// Work around a bug caused by caching the wrongly cased unit name.
fRenamedMissingUnits: TStringToStringTree;
procedure InitCodeTool; procedure InitCodeTool;
function HandleCodetoolError: TModalResult; function HandleCodetoolError: TModalResult;
public public
@ -74,8 +72,6 @@ type
property IsConsoleApp: Boolean read fIsConsoleApp write fIsConsoleApp; property IsConsoleApp: Boolean read fIsConsoleApp write fIsConsoleApp;
property AskAboutError: Boolean read fAskAboutError write fAskAboutError; property AskAboutError: Boolean read fAskAboutError write fAskAboutError;
property Settings: TConvertSettings read fSettings write fSettings; property Settings: TConvertSettings read fSettings write fSettings;
property RenamedMissingUnits: TStringToStringTree read fRenamedMissingUnits
write fRenamedMissingUnits;
end; end;
{ TConvDelphiCodeTool } { TConvDelphiCodeTool }

View File

@ -145,8 +145,6 @@ type
fAllCommentedUnits: TStringList; fAllCommentedUnits: TStringList;
// Units that are found and will be added to project and converted. // Units that are found and will be added to project and converted.
fUnitsToAddToProject: TStringList; fUnitsToAddToProject: TStringList;
// Work around a bug caused by caching the wrongly cased unit name.
fRenamedMissingUnits: TStringToStringTree;
fSettings: TConvertSettings; fSettings: TConvertSettings;
function ConvertSub: TModalResult; function ConvertSub: TModalResult;
procedure CleanUpCompilerOptionsSearchPaths(Options: TBaseCompilerOptions); procedure CleanUpCompilerOptionsSearchPaths(Options: TBaseCompilerOptions);
@ -624,8 +622,6 @@ begin
try try
if fSettings.UnitsReplaceMode<>rlDisabled then begin if fSettings.UnitsReplaceMode<>rlDisabled then begin
fUsedUnitsTool:=TUsedUnitsTool.Create(fCTLink, fOrigUnitFilename); fUsedUnitsTool:=TUsedUnitsTool.Create(fCTLink, fOrigUnitFilename);
if Assigned(fOwnerConverter) then
fCTLink.RenamedMissingUnits:=fOwnerConverter.fRenamedMissingUnits;
// Find and prepare the missing units. Don't replace yet. // Find and prepare the missing units. Don't replace yet.
Result:=fUsedUnitsTool.Prepare; Result:=fUsedUnitsTool.Prepare;
if Result<>mrOk then exit; if Result<>mrOk then exit;
@ -793,13 +789,11 @@ begin
fAllCommentedUnits:=TStringList.Create; fAllCommentedUnits:=TStringList.Create;
fAllCommentedUnits.Sorted:=true; fAllCommentedUnits.Sorted:=true;
fUnitsToAddToProject:=TStringList.Create; fUnitsToAddToProject:=TStringList.Create;
fRenamedMissingUnits:=TStringToStringTree.Create(true);
fPrevSelectedPath:=fSettings.MainPath; fPrevSelectedPath:=fSettings.MainPath;
end; end;
destructor TConvertDelphiPBase.Destroy; destructor TConvertDelphiPBase.Destroy;
begin begin
fRenamedMissingUnits.Free;
fUnitsToAddToProject.Free; fUnitsToAddToProject.Free;
fAllCommentedUnits.Free; fAllCommentedUnits.Free;
fSettings.Free; fSettings.Free;

View File

@ -209,17 +209,8 @@ begin
if NewInFilename<>'' then if NewInFilename<>'' then
s:=s+' in '''+NewInFilename+''''; s:=s+' in '''+NewInFilename+'''';
if AFilename<>'' then begin // unit found if AFilename<>'' then begin // unit found
if (NewUnitName<>OldUnitName) or (NewInFilename<>OldInFilename) then begin if (NewUnitName<>OldUnitName) or (NewInFilename<>OldInFilename) then
ToBeRenamedOrRemoved(OldUnitName, NewUnitName); // fix case ToBeRenamedOrRemoved(OldUnitName, NewUnitName); // fix case
// FindUnitCaseInsensitive reports only the 1. instance of a missing unit
// with different casing. This workaround can be removed when it is fixed.
if Assigned(RenamedMissingUnits) then
RenamedMissingUnits[OldUnitName]:=NewUnitName;
end
else if Assigned(RenamedMissingUnits) then begin
if RenamedMissingUnits.Contains(OldUnitName) then
ToBeRenamedOrRemoved(OldUnitName, RenamedMissingUnits[OldUnitName]);
end;
end end
else begin else begin
// Omit Windows specific units from the list if target is "Windows only", // Omit Windows specific units from the list if target is "Windows only",