mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-10 15:40:32 +02:00
Codetools: Fix renaming dotted unit names + many functions dealing with dotted indentifiers. Issue #40195, patch by CCRDude.
This commit is contained in:
parent
5e9e89a57b
commit
0991e39f7d
@ -5183,7 +5183,7 @@ begin
|
||||
if not IsIdentStartChar[p^] then exit;
|
||||
repeat
|
||||
inc(p);
|
||||
until not IsIdentChar[p^];
|
||||
until not IsDottedIdentChar[p^];
|
||||
if p^<>'.' then break;
|
||||
inc(p);
|
||||
until false;
|
||||
@ -5211,7 +5211,7 @@ begin
|
||||
if not IsIdentStartChar[p^] then exit;
|
||||
repeat
|
||||
inc(p);
|
||||
until not IsIdentChar[p^];
|
||||
until not IsDottedIdentChar[p^];
|
||||
if p^<>'.' then break;
|
||||
inc(p);
|
||||
until false;
|
||||
|
@ -274,6 +274,8 @@ type
|
||||
function CompareSrcIdentifiers(Identifier1, Identifier2: PChar): boolean;
|
||||
function CompareSrcIdentifiers(CleanStartPos: integer;
|
||||
AnIdentifier: PChar): boolean;
|
||||
function CompareDottedSrcIdentifiers(CleanStartPos: integer;
|
||||
AnIdentifier: PChar): boolean;
|
||||
function CompareSrcIdentifiersMethod(Identifier1, Identifier2: Pointer): integer;
|
||||
function ExtractIdentifier(CleanStartPos: integer): string;
|
||||
function ExtractDottedIdentifier(CleanStartPos: integer): string;
|
||||
@ -3138,6 +3140,34 @@ begin
|
||||
Result:=not IsIdentChar[Src[CleanStartPos]];
|
||||
end;
|
||||
|
||||
function TCustomCodeTool.CompareDottedSrcIdentifiers(CleanStartPos: integer;
|
||||
AnIdentifier: PChar): boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
if (AnIdentifier=nil) or (CleanStartPos<1) or (CleanStartPos>SrcLen) then
|
||||
exit;
|
||||
if AnIdentifier^='&' then
|
||||
Inc(AnIdentifier);
|
||||
if Src[CleanStartPos]='&' then
|
||||
begin
|
||||
Inc(CleanStartPos);
|
||||
if CleanStartPos>SrcLen then
|
||||
exit;
|
||||
end;
|
||||
while IsDottedIdentChar[AnIdentifier^] do begin
|
||||
if (UpChars[AnIdentifier^]=UpChars[Src[CleanStartPos]]) then begin
|
||||
inc(AnIdentifier);
|
||||
inc(CleanStartPos);
|
||||
if CleanStartPos>SrcLen then begin
|
||||
Result:=not IsDottedIdentChar[AnIdentifier^];
|
||||
exit;
|
||||
end;
|
||||
end else
|
||||
exit(false);
|
||||
end;
|
||||
Result:=not IsDottedIdentChar[Src[CleanStartPos]];
|
||||
end;
|
||||
|
||||
function TCustomCodeTool.CompareSrcIdentifiersMethod(Identifier1,
|
||||
Identifier2: Pointer): integer;
|
||||
begin
|
||||
|
@ -6864,7 +6864,7 @@ var
|
||||
ReadNextAtom; // read name
|
||||
ReadNextUsedUnit(UnitNamePos,UnitInFilePos); // read dotted name + IN file
|
||||
if CurPos.StartPos>SrcLen then break;
|
||||
if CompareSrcIdentifiers(UnitNamePos.StartPos,UnitNameP) then begin // compare case insensitive
|
||||
if CompareDottedSrcIdentifiers(UnitNamePos.StartPos,UnitNameP) then begin // compare case insensitive
|
||||
if CleanPosToCaret(UnitNamePos.StartPos,ReferencePos) then begin
|
||||
//DebugLn(['CheckUsesSection found in uses section: ',Dbgs(ReferencePos)]);
|
||||
Result:=true;
|
||||
|
Loading…
Reference in New Issue
Block a user