mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-26 08:22:01 +01:00
Converter: do dummy string replacement for known problematic syntax when CodeTools raised an exception. Issue #23552
git-svn-id: trunk@41967 -
This commit is contained in:
parent
09cfe454ce
commit
1cc1c541af
@ -504,6 +504,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TDelphiUnit.CopyAndLoadFile: TModalResult;
|
function TDelphiUnit.CopyAndLoadFile: TModalResult;
|
||||||
|
var
|
||||||
|
CodeOk, CodeFixed: Boolean;
|
||||||
begin
|
begin
|
||||||
fOwnerConverter.fSettings.AddLogLine(Format(lisConvDelphiConvertingFile,
|
fOwnerConverter.fSettings.AddLogLine(Format(lisConvDelphiConvertingFile,
|
||||||
[fOrigUnitFilename]));
|
[fOrigUnitFilename]));
|
||||||
@ -536,8 +538,25 @@ begin
|
|||||||
// Fix include file names.
|
// Fix include file names.
|
||||||
Result:=FixIncludeFiles;
|
Result:=FixIncludeFiles;
|
||||||
if Result<>mrOK then exit;
|
if Result<>mrOK then exit;
|
||||||
// Create a tool for missing units.
|
CodeFixed:=False;
|
||||||
fUsedUnitsTool:=TUsedUnitsTool.Create(fCTLink, fOrigUnitFilename);
|
repeat
|
||||||
|
CodeOk:=True;
|
||||||
|
try
|
||||||
|
// Create a tool for missing units.
|
||||||
|
fUsedUnitsTool:=TUsedUnitsTool.Create(fCTLink, fOrigUnitFilename);
|
||||||
|
except
|
||||||
|
// If CodeTool's BuildTree raised exception, try dummy replacement for
|
||||||
|
// some known problematic syntax, currently only OleVariant.type.
|
||||||
|
if CodeFixed then
|
||||||
|
Raise // There was a second exception -> we are doomed!
|
||||||
|
else begin
|
||||||
|
with fPascalBuffer do
|
||||||
|
Source:=StringReplace(Source,'.type','.&type',[rfReplaceAll]);
|
||||||
|
CodeOk := False;
|
||||||
|
CodeFixed := True; // Try replacements only once
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
until CodeOk;
|
||||||
if fOwnerConverter is TConvertDelphiProjPack then
|
if fOwnerConverter is TConvertDelphiProjPack then
|
||||||
with TConvertDelphiProjPack(fOwnerConverter) do begin
|
with TConvertDelphiProjPack(fOwnerConverter) do begin
|
||||||
fUsedUnitsTool.OnCheckPackageDependency:=@CheckPackageDep;
|
fUsedUnitsTool.OnCheckPackageDependency:=@CheckPackageDep;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user