mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-03 09:19:29 +01:00
fixing include directives now use SourceChangeCache
git-svn-id: trunk@8871 -
This commit is contained in:
parent
3332dcc0a0
commit
55078287e1
@ -77,5 +77,6 @@ begin
|
||||
// fix the unitnames in the uses section
|
||||
//if not CodeToolBoss.FixUsesSectionsCase(Code) then
|
||||
// raise Exception.Create('unable to fix unit names in '+Filename+' '+CodeToolBoss.ErrorMessage);
|
||||
writeln(Code.Source);
|
||||
end.
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ uses
|
||||
;
|
||||
|
||||
{$I BROKENincfiles.inc}// must be fixed to brokenincfiles.inc
|
||||
{$I ../ScanExamples/BROKENincfiles.inc}// must be fixed to ../scanExamples/brokenincfiles.inc
|
||||
{$I ../ScanExamples/BROKENincfiles.inc}// must be fixed to ../scanexamples/brokenincfiles.inc
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
@ -532,17 +532,17 @@ begin
|
||||
exit;
|
||||
end;
|
||||
|
||||
if ToPos>FromPos then begin
|
||||
// this is a replace/delete operation (in cleaned code)
|
||||
// -> check the whole range for writable buffers
|
||||
if not MainScanner.WholeRangeIsWritable(FromPos,ToPos,true) then exit;
|
||||
end else if IsDirectChange and (FromDirectPos<ToDirectPos) then begin
|
||||
if IsDirectChange and (FromDirectPos<ToDirectPos) then begin
|
||||
// this is a direct replace/delete operation
|
||||
// -> check if the DirectCode is writable
|
||||
if DirectCode.ReadOnly then
|
||||
RaiseCodeReadOnly(DirectCode);
|
||||
end;
|
||||
if not IsDirectChange then begin
|
||||
end else if FromPos<ToPos then begin
|
||||
// this is a replace/delete operation (in cleaned code)
|
||||
// -> check the whole range for writable buffers
|
||||
if not MainScanner.WholeRangeIsWritable(FromPos,ToPos,true) then exit;
|
||||
end
|
||||
else if not IsDirectChange then begin
|
||||
if not MainScanner.CleanedPosToCursor(FromPos,FromDirectPos,p) then begin
|
||||
{$IFDEF CTDEBUG}
|
||||
DebugLn('TSourceChangeCache.ReplaceEx IGNORED, because not in clean pos');
|
||||
|
||||
@ -4405,7 +4405,7 @@ var
|
||||
AFilename:=SearchIncludeFilename(AFilename);
|
||||
if OldFilename<>AFilename then begin
|
||||
DebugLn('FixFilename replacing in '+Code.Filename+' include directive "',OldFilename,'" with "',AFilename,'"');
|
||||
ASource:=copy(ASource,1,StartPos-1)+AFilename+copy(ASource,EndPos,length(ASource));
|
||||
SourceChangeCache.ReplaceEx(gtNone,gtNone,0,0,Code,StartPos,EndPos,AFilename);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -4420,6 +4420,7 @@ begin
|
||||
if (Scanner=nil) or (Scanner.MainCode=nil) then exit;
|
||||
ASource:=Code.Source;
|
||||
Scanner.Scan(false,false,false,false);// init scanner, but do not scan
|
||||
SourceChangeCache.MainScanner:=Scanner;
|
||||
|
||||
Result:=true;
|
||||
NestedComments:=Scanner.NestedComments;
|
||||
@ -4433,6 +4434,7 @@ begin
|
||||
p:=FindCommentEnd(ASource,p,NestedComments);
|
||||
//DebugLn('TStandardCodeTool.FixIncludeFilenames ',dbgs(p));
|
||||
until false;
|
||||
Result:=SourceChangeCache.Apply;
|
||||
end;
|
||||
|
||||
function TStandardCodeTool.ReadTilGuessedUnclosedBlock(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user