codetools: BuildTreeAndGetCleanPos: check if scanrange is still valid

git-svn-id: trunk@29809 -
This commit is contained in:
mattias 2011-03-12 23:57:11 +00:00
parent 420d07490d
commit 2737646f2a

View File

@ -4530,8 +4530,8 @@ begin
debugln(['TPascalParserTool.FetchScannerSource first character changed ',MainFilename]); debugln(['TPascalParserTool.FetchScannerSource first character changed ',MainFilename]);
{$ENDIF} {$ENDIF}
AllChanged:=true; AllChanged:=true;
end else if DiffPos>NewSrcLen then begin end else if (DiffPos>NewSrcLen) and (not LastErrorValid) then begin
// no chance => keep all nodes // no change and no error => keep all nodes
{$IFDEF VerboseUpdateNeeded} {$IFDEF VerboseUpdateNeeded}
debugln(['TPascalParserTool.FetchScannerSource cleansrc has not changed => keep all nodes ',MainFilename]); debugln(['TPascalParserTool.FetchScannerSource cleansrc has not changed => keep all nodes ',MainFilename]);
{$ENDIF} {$ENDIF}
@ -4549,7 +4549,7 @@ begin
Node:=Node.NextBrother; Node:=Node.NextBrother;
// mark section as unfinished // mark section as unfinished
Node.EndPos:=-1; Node.EndPos:=-1;
if (Node.Desc=ctnEndPoint) and (Node.EndPos<=DiffPos) then begin if (Node.Desc=ctnEndPoint) and (not LastErrorValid) then begin
// difference is behind nodes => keep all nodes // difference is behind nodes => keep all nodes
{$IFDEF VerboseUpdateNeeded} {$IFDEF VerboseUpdateNeeded}
debugln(['TPascalParserTool.FetchScannerSource cleansrc was changed after scanned nodes => keep all nodes, last node=',Node.DescAsString,' ',MainFilename]); debugln(['TPascalParserTool.FetchScannerSource cleansrc was changed after scanned nodes => keep all nodes, last node=',Node.DescAsString,' ',MainFilename]);
@ -4705,11 +4705,20 @@ begin
Node:=FindSectionNodeAtPos(CleanCursorPos); Node:=FindSectionNodeAtPos(CleanCursorPos);
if (Node<>nil) and (Node.EndPos>CleanCursorPos) then begin if (Node<>nil) and (Node.EndPos>CleanCursorPos) then begin
// cursor in scanned range // cursor in scanned range
ScanRange:=ScannedRange; if Node.Desc in (AllSourceTypes+[ctnInterface]) then
if (TreeRange=trTillCursorSection) then
if ScanRange<=lsrImplementationStart then
ScanRange:=lsrImplementationStart ScanRange:=lsrImplementationStart
else if Node.Desc=ctnUsesSection then begin
if Node.Parent.Desc=ctnImplementation then
ScanRange:=lsrInitializationStart
else else
ScanRange:=lsrInterfaceStart;
end else if Node.Desc=ctnImplementation then
ScanRange:=lsrInitializationStart
else if Node.Desc=ctnInitialization then
ScanRange:=lsrFinalizationStart
else
ScanRange:=lsrEnd;
if UpdateNeeded(ScanRange) then
ScanRange:=lsrEnd; ScanRange:=lsrEnd;
end; end;
end; end;