mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 07:30:22 +02:00
codetools: fixed reparsing initialization, finalization, begin
git-svn-id: trunk@36972 -
This commit is contained in:
parent
d9a785c090
commit
ef54620381
@ -677,6 +677,8 @@ begin
|
||||
case Node.Desc of
|
||||
ctnInterface: ScannedRange:=lsrInterfaceStart;
|
||||
ctnImplementation: ScannedRange:=lsrImplementationStart;
|
||||
ctnInitialization: ScannedRange:=lsrInitializationStart;
|
||||
ctnFinalization: ScannedRange:=lsrFinalizationStart;
|
||||
end;
|
||||
if ord(Range)<=ord(ScannedRange) then exit;
|
||||
|
||||
@ -4895,19 +4897,26 @@ begin
|
||||
end else begin
|
||||
// some nodes can be kept
|
||||
// find first node to delete
|
||||
DeleteNode:=Node.LastChild;
|
||||
if DeleteNode<>nil then begin
|
||||
while (DeleteNode.PriorBrother<>nil)
|
||||
and (DeleteNode.StartPos>=DiffPos) do
|
||||
DeleteNode:=DeleteNode.PriorBrother;
|
||||
if (DeleteNode.Desc=ctnUsesSection)
|
||||
and (DiffPos>=DeleteNode.StartPos+length('uses')) then begin
|
||||
// keep uses section, just delete the used units nodes
|
||||
DeleteNode.EndPos:=-1;
|
||||
DeleteNode:=DeleteNode.Next;
|
||||
end;
|
||||
end else
|
||||
DeleteNode:=Node.NextBrother;
|
||||
if Node.Desc in [ctnInitialization,ctnFinalization,ctnBeginBlock]
|
||||
then begin
|
||||
// statement nodes are always parsed completely
|
||||
DeleteNode:=Node;
|
||||
Node:=Node.PriorBrother;
|
||||
end else begin
|
||||
DeleteNode:=Node.LastChild;
|
||||
if DeleteNode<>nil then begin
|
||||
while (DeleteNode.PriorBrother<>nil)
|
||||
and (DeleteNode.StartPos>=DiffPos) do
|
||||
DeleteNode:=DeleteNode.PriorBrother;
|
||||
if (DeleteNode.Desc=ctnUsesSection)
|
||||
and (DiffPos>=DeleteNode.StartPos+length('uses')) then begin
|
||||
// keep uses section, just delete the used units nodes
|
||||
DeleteNode.EndPos:=-1;
|
||||
DeleteNode:=DeleteNode.Next;
|
||||
end;
|
||||
end else
|
||||
DeleteNode:=Node.NextBrother;
|
||||
end;
|
||||
if DeleteNode<>nil then begin
|
||||
{$IFDEF VerboseUpdateNeeded}
|
||||
debugln(['TPascalParserTool.FetchScannerSource keep parts, last kept section=',Node.DescAsString,' FirstDeleteNode=',DeleteNode.DescAsString,' ',MainFilename]);
|
||||
|
Loading…
Reference in New Issue
Block a user