codetools: fixed closing with variable nodes, bug #10640

git-svn-id: trunk@19633 -
This commit is contained in:
mattias 2009-04-26 13:25:24 +00:00
parent 670a37d8c4
commit b46c4051e3
4 changed files with 14 additions and 12 deletions

View File

@ -2173,7 +2173,8 @@ begin
if ChildNode<>nil then begin
Result:=ChildNode;
exit;
end;
end else
Result:=Brother;
end;
Brother:=Brother.NextBrother;
end;

View File

@ -2072,7 +2072,7 @@ begin
DebugLn('[TFindDeclarationTool.FindDeclarationOfIdentAtParam] Identifier=',
'"',GetIdentifier(Params.Identifier),'"',
' ContextNode=',NodeDescriptionAsString(Params.ContextNode.Desc),
' "',copy(Src,Params.ContextNode.StartPos,20),'"');
' "',dbgstr(copy(Src,Params.ContextNode.StartPos,20)),'"');
{$ENDIF}
Result:=false;
// search in cleaned source
@ -2536,7 +2536,7 @@ var
repeat
// search for prior node
{$IFDEF ShowTriedIdentifiers}
//DebugLn('[TFindDeclarationTool.FindIdentifierInContext] Searching prior node of ',ContextNode.DescAsString);
DebugLn('[TFindDeclarationTool.FindIdentifierInContext] Searching prior node of ',ContextNode.DescAsString,' ',dbgstr(copy(Src,ContextNode.StartPos,ContextNode.EndPos-ContextNode.StartPos)));
{$ENDIF}
LastSearchedNode:=ContextNode;
@ -5682,13 +5682,12 @@ var
// build new param flags for sub identifiers
Params.Flags:=[fdfSearchInAncestors,fdfExceptionOnNotFound]
+(fdfGlobals*Params.Flags);
Params.ContextNode:=ExprType.Context.Node;
if ExprType.Context.Node=StartContext.Node then begin
// there is no special context -> search in parent contexts too
Params.Flags:=Params.Flags
+[fdfSearchInParentNodes,fdfIgnoreCurContextNode];
Params.Flags:=Params.Flags+[fdfSearchInParentNodes,fdfIgnoreCurContextNode];
end else begin
// only search in special context
Params.ContextNode:=ExprType.Context.Node;
end;
// check identifier for overloaded procs
@ -5703,7 +5702,7 @@ var
// search ...
Params.SetIdentifier(Self,@Src[CurAtom.StartPos],@CheckSrcIdentifier);
{$IFDEF ShowExprEval}
DebugLn(' ResolveIdentifier Ident="',GetIdentifier(Params.Identifier),'"');
DebugLn(' ResolveIdentifier Ident="',GetIdentifier(Params.Identifier),'" ',Params.ContextNode.DescAsString,' ',dbgstr(copy(ExprType.Context.Tool.Src,Params.ContextNode.StartPos,15)));
{$ENDIF}
if ExprType.Context.Tool.FindIdentifierInContext(Params) then begin
if not Params.NewCodeTool.NodeIsConstructor(Params.NewNode) then begin
@ -6068,7 +6067,7 @@ begin
{$IFDEF ShowExprEval}
DebugLn('[TFindDeclarationTool.FindExpressionTypeOfVariable]',
' Flags=[',FindDeclarationFlagsAsString(Params.Flags),']',
' StartContext=',StartContext.Node.DescAsString
' StartContext=',StartContext.Node.DescAsString,'=',dbgstr(copy(StartContext.Tool.Src,StartContext.Node.StartPos,15))
);
{$ENDIF}

View File

@ -2507,10 +2507,12 @@ function TPascalParserTool.ReadWithStatement(ExceptionOnError,
CurNode.EndPos:=EndPos;
EndChildNode; // ctnWithVariable
// set all with variable ends
while (WithVarNode<>nil) and (WithVarNode.FirstChild=nil) do begin
WithVarNode.EndPos:=EndPos;
repeat
WithVarNode:=WithVarNode.PriorBrother;
end;
if (WithVarNode=nil) or (WithVarNode.Desc<>ctnWithVariable)
or (WithVarNode.EndPos>0) then break;
WithVarNode.EndPos:=EndPos;
until false;
end;
end;

View File

@ -48,7 +48,7 @@ interface
uses
Classes, SysUtils, LCLProc, Forms, Controls, LCLType, LCLIntf, LResources,
Graphics, LMessages, WSLCLClasses, WSControls,
Graphics, LMessages, WSLCLClasses,
{$IFDEF UseGtkGLX}
GLGtkGlxContext;
{$ENDIF}