mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-10-31 03:01:28 +01:00 
			
		
		
		
	codetools: fixed skipping program name nodes
git-svn-id: trunk@55855 -
This commit is contained in:
		
							parent
							
								
									80021aec47
								
							
						
					
					
						commit
						fef3d14b6d
					
				| @ -1043,6 +1043,8 @@ begin | ||||
|   end; | ||||
|   if InsertPos<1 then begin | ||||
|     InsertNode:=FindFirstSectionChild; | ||||
|     while (InsertNode<>nil) and (InsertNode.Desc=ctnIdentifier) do | ||||
|       InsertNode:=InsertNode.NextBrother; | ||||
|     if InsertNode<>nil then begin | ||||
|       Indent:=Beauty.GetLineIndent(Src,InsertNode.StartPos); | ||||
|       if InsertNode.Desc=ctnUsesSection then | ||||
|  | ||||
| @ -74,7 +74,7 @@ const | ||||
|   ctnResStrSection      = 13; | ||||
|   ctnLabelSection       = 14; | ||||
|   ctnPropertySection    = 15; | ||||
|   ctnUsesSection        = 16; // child nodes are ctnUseUnit | ||||
|   ctnUsesSection        = 16; // child nodes are ctnUseUnit, parent is ctnInterface,ctnImplementation,ctnProgram,ctnPackage,ctnLibrary | ||||
|   ctnRequiresSection    = 17; | ||||
|   ctnContainsSection    = 18; // child nodes are ctnUseUnit | ||||
|   ctnExportsSection     = 19; | ||||
|  | ||||
| @ -555,7 +555,7 @@ var | ||||
|   p: PChar; | ||||
|   HasSourceType: Boolean; | ||||
|   ok: Boolean; | ||||
|   OldLastNode: TCodeTreeNode; | ||||
|   OldLastNode, SubNode: TCodeTreeNode; | ||||
|   OldLastPos: Integer; | ||||
|   aNameSpace, aName: String; | ||||
| begin | ||||
| @ -791,9 +791,12 @@ begin | ||||
|             Node.EndPos:=-1; | ||||
|             MoveCursorToCleanPos(Node.StartPos); | ||||
|           end else begin | ||||
|             if Node.FirstChild.Desc=ctnUsesSection then begin | ||||
|             SubNode:=Node.FirstChild; | ||||
|             while (SubNode<>nil) and (SubNode.Desc=ctnIdentifier) do | ||||
|               SubNode:=SubNode.NextBrother; | ||||
|             if (SubNode<>nil) and (SubNode.Desc=ctnUsesSection) then begin | ||||
|               // uses section is already parsed | ||||
|               if Node.FirstChild.FirstChild=nil then | ||||
|               if SubNode.FirstChild=nil then | ||||
|                 RaiseException(20170421194939, | ||||
|                   'TPascalParserTool.BuildTree inconsistency: uses section was not scanned completely and was not deleted'); | ||||
|               if ScannedRange<lsrMainUsesSectionEnd then | ||||
| @ -6188,6 +6191,8 @@ begin | ||||
|           exit; | ||||
|         end; | ||||
|         Result:=Result.FirstChild; | ||||
|         while (Result.NextBrother<>nil) and (Result.Desc=ctnIdentifier) do | ||||
|           Result:=Result.NextBrother; | ||||
|         if Result.Desc<>ctnUsesSection then exit; | ||||
|         // lsrMainUsesSectionStart in program | ||||
|         if Range=lsrMainUsesSectionStart then exit; | ||||
| @ -6203,6 +6208,8 @@ begin | ||||
|           exit; | ||||
|         end; | ||||
|         Result:=Result.FirstChild; | ||||
|         while (Result.NextBrother<>nil) and (Result.Desc=ctnIdentifier) do | ||||
|           Result:=Result.NextBrother; | ||||
|         if Result.Desc=ctnUsesSection then | ||||
|           Result:=Result.NextSkipChilds; | ||||
|         exit; | ||||
| @ -6230,9 +6237,11 @@ var | ||||
| begin | ||||
|   Result:=FindSectionNodeAtPos(P); | ||||
|   if Result=nil then exit; | ||||
|   if (Result.FirstChild<>nil) and (Result.FirstChild.Desc=ctnUsesSection) then | ||||
|   UsesNode:=Result.FirstChild; | ||||
|   while (UsesNode<>nil) and (UsesNode.Desc=ctnIdentifier) do | ||||
|     UsesNode:=UsesNode.NextBrother; | ||||
|   if (UsesNode<>nil) and (UsesNode.Desc=ctnUsesSection) then | ||||
|   begin | ||||
|     UsesNode:=Result.FirstChild; | ||||
|     if (UsesNode.StartPos<=P) and (UsesNode.EndPos>P) then | ||||
|       Result:=UsesNode; | ||||
|   end; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 mattias
						mattias