mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 07:19:19 +02:00
MG: added some component rename checks
git-svn-id: trunk@3461 -
This commit is contained in:
parent
a60a0c9584
commit
7394eb6f92
@ -374,12 +374,14 @@ begin
|
||||
writeln('DirectCode=',DirectCode.Filename,' DirectPos=',FromDirectPos,'-',ToDirectPos);
|
||||
{$ENDIF}
|
||||
Result:=false;
|
||||
if (MainScanner=nil) or (FromPos>ToPos) or (FromPos<1)
|
||||
or (ToPos>MainScanner.CleanedLen+1) then
|
||||
exit;
|
||||
IsDirectChange:=DirectCode<>nil;
|
||||
if not IsDirectChange then begin
|
||||
if (MainScanner=nil) or (FromPos>ToPos) or (FromPos<1)
|
||||
or (ToPos>MainScanner.CleanedLen+1) then
|
||||
exit;
|
||||
end;
|
||||
if FindEntryInRange(FromPos,ToPos)<>nil then exit;
|
||||
|
||||
|
||||
if ToPos>FromPos then begin
|
||||
// this is a delete operation -> check the whole range for writable buffers
|
||||
if not MainScanner.WholeRangeIsWritable(FromPos,ToPos) then exit;
|
||||
@ -581,7 +583,7 @@ begin
|
||||
InsertText:=FirstEntry.Text;
|
||||
// add after gap
|
||||
AddAfterGap(FirstEntry);
|
||||
// add text from nodes inserted at the same position
|
||||
// add text from every nodes inserted at the same position
|
||||
PrecNode:=FEntries.FindPrecessor(CurNode);
|
||||
CurEntry:=FirstEntry;
|
||||
while (PrecNode<>nil) do begin
|
||||
|
@ -1064,12 +1064,18 @@ begin
|
||||
if (OldFormName='') or (OldFormClassName='')
|
||||
or (NewFormName='') or (NewFormClassName='')
|
||||
or (SourceChangeCache=nil) then exit;
|
||||
if (OldFormName=NewFormName)
|
||||
and (OldFormClassName=NewFormClassName) then exit;
|
||||
IdentList:=TStringList.Create;
|
||||
try
|
||||
IdentList.Add(OldFormName);
|
||||
IdentList.Add(NewFormName);
|
||||
IdentList.Add(OldFormClassName);
|
||||
IdentList.Add(NewFormClassName);
|
||||
if (OldFormName<>NewFormName) then begin
|
||||
IdentList.Add(OldFormName);
|
||||
IdentList.Add(NewFormName);
|
||||
end;
|
||||
if (OldFormClassName<>NewFormClassName) then begin
|
||||
IdentList.Add(OldFormClassName);
|
||||
IdentList.Add(NewFormClassName);
|
||||
end;
|
||||
Result:=ReplaceIdentifiers(IdentList,SourceChangeCache);
|
||||
finally
|
||||
IdentList.Free;
|
||||
@ -1097,6 +1103,7 @@ function TStandardCodeTool.ReplaceIdentifiers(IdentList: TStrings;
|
||||
MaxPos:=length(CurSource);
|
||||
StartPos:=1;
|
||||
// go through all source parts between compiler directives
|
||||
writeln('TStandardCodeTool.ReplaceIdentifiers ',ACode.Filename);
|
||||
repeat
|
||||
EndPos:=FindNextCompilerDirective(CurSource,StartPos,
|
||||
Scanner.NestedComments);
|
||||
@ -1107,11 +1114,16 @@ function TStandardCodeTool.ReplaceIdentifiers(IdentList: TStrings;
|
||||
if IdentStart<EndPos then begin
|
||||
i:=0;
|
||||
while i<IdentList.Count do begin
|
||||
if BasicCodeTools.CompareIdentifiers(PChar(IdentList[i]),
|
||||
@CurSource[IdentStart])=0 then
|
||||
if (IdentList[i]<>'')
|
||||
and (BasicCodeTools.CompareIdentifiers(PChar(IdentList[i]),
|
||||
@CurSource[IdentStart])=0)
|
||||
and (IdentList[i]<>IdentList[i+1]) then
|
||||
begin
|
||||
// identifier found -> replace
|
||||
IdentEnd:=IdentStart+length(IdentList[i]);
|
||||
writeln('TStandardCodeTool.ReplaceIdentifiers replacing: ',
|
||||
' "',copy(CurSource,IdentStart,IdentEnd-IdentStart),'" -> "',IdentList[i+1],'" at ',IdentStart
|
||||
);
|
||||
SourceChangeCache.ReplaceEx(gtNone,gtNone,1,1,
|
||||
ACode,IdentStart,IdentEnd,IdentList[i+1]);
|
||||
break;
|
||||
|
@ -1498,8 +1498,8 @@ function TProject.IndexOfUnitWithFormName(const AFormName: string;
|
||||
begin
|
||||
Result:=UnitCount-1;
|
||||
while (Result>=0) do begin
|
||||
if (OnlyProjectUnits and Units[Result].IsPartOfProject)
|
||||
or (not OnlyProjectUnits)
|
||||
if ((OnlyProjectUnits and Units[Result].IsPartOfProject)
|
||||
or (not OnlyProjectUnits))
|
||||
and (IgnoreUnit<>Units[Result]) then begin
|
||||
if (AnsiCompareText(Units[Result].FormName,AFormName)=0)
|
||||
or ((Units[Result].Form<>nil)
|
||||
@ -2066,6 +2066,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.82 2002/10/04 21:31:56 lazarus
|
||||
MG: added some component rename checks
|
||||
|
||||
Revision 1.81 2002/10/02 16:16:39 lazarus
|
||||
MG: accelerated unitdependencies
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user