From 5f8d11d5c2a63757a4ddcb5879bad5cea0a0052c Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 30 Oct 2010 14:10:21 +0000 Subject: [PATCH] codetools: CompleteLocalVariableAsParameter: fixed skipping sub context git-svn-id: trunk@27977 - --- components/codetools/codecompletiontool.pas | 11 +++++------ components/codetools/finddeclarationtool.pas | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/components/codetools/codecompletiontool.pas b/components/codetools/codecompletiontool.pas index 555ad89d51..78eaa01f7e 100644 --- a/components/codetools/codecompletiontool.pas +++ b/components/codetools/codecompletiontool.pas @@ -1857,16 +1857,15 @@ begin ExprType:=FindExpressionResultType(Params,ProcStartPos,ProcNameAtom.StartPos); if ExprType.Desc<>xtContext then exit; Context:=ExprType.Context; - //debugln(['TCodeCompletionCodeTool.CompleteLocalVariableByParameter search proc in sub context']); + //debugln(['TCodeCompletionCodeTool.CompleteLocalVariableByParameter search proc in sub context: ',ExprTypeToString(ExprType)]); end; // find declaration of parameter list Params.ContextNode:=Context.Node; Params.SetIdentifier(Self,@Src[ProcNameAtom.StartPos],nil); - Params.Flags:=fdfGlobals+[fdfSearchInAncestors, - fdfFindVariable,fdfIgnoreCurContextNode]; + Params.Flags:=fdfGlobals+[fdfSearchInAncestors,fdfFindVariable]; if Context.Node=CursorNode then - Include(Params.Flags,fdfSearchInParentNodes); + Params.Flags:=Params.Flags+[fdfSearchInParentNodes,fdfIgnoreCurContextNode]; CleanPosToCodePos(VarNameAtom.StartPos,IgnorePos); IgnoreErrorAfter:=IgnorePos; try @@ -1878,7 +1877,7 @@ begin NewType:=''; MissingUnitName:=''; if Params.NewNode<>nil then begin - DebugLn('TCodeCompletionCodeTool.CompleteLocalVariableAsParameter Proc/PropNode=',Params.NewNode.DescAsString,' ',copy(Params.NewCodeTool.Src,Params.NewNode.StartPos,50)); + //DebugLn('TCodeCompletionCodeTool.CompleteLocalVariableAsParameter Proc/PropNode=',Params.NewNode.DescAsString,' ',copy(Params.NewCodeTool.Src,Params.NewNode.StartPos,50)); ParameterNode:=Params.NewCodeTool.FindNthParameterNode(Params.NewNode, ParameterIndex); if (ParameterNode=nil) @@ -1887,7 +1886,7 @@ begin exit; end; if ParameterNode<>nil then begin - DebugLn('TCodeCompletionCodeTool.CompleteLocalVariableAsParameter ParameterNode=',ParameterNode.DescAsString,' ',copy(Params.NewCodeTool.Src,ParameterNode.StartPos,50)); + //DebugLn('TCodeCompletionCodeTool.CompleteLocalVariableAsParameter ParameterNode=',ParameterNode.DescAsString,' ',copy(Params.NewCodeTool.Src,ParameterNode.StartPos,50)); TypeNode:=FindTypeNodeOfDefinition(ParameterNode); if TypeNode=nil then begin DebugLn(' CompleteLocalVariableAsParameter Parameter has no type'); diff --git a/components/codetools/finddeclarationtool.pas b/components/codetools/finddeclarationtool.pas index 29208206ca..92b7f62a38 100644 --- a/components/codetools/finddeclarationtool.pas +++ b/components/codetools/finddeclarationtool.pas @@ -3022,7 +3022,7 @@ begin '"'+GetIdentifier(Params.Identifier)+'"', ' Context="'+ContextNode.DescAsString+'" "'+StringToPascalConst(copy(Src,ContextNode.StartPos,20)),'"', ' File="'+ExtractFilename(MainFilename)+'"', - ' Flags=['+FindDeclarationFlagsAsString(Params.Flags)+']' + ' Flags=['+dbgs(Params.Flags)+']' ); {$ELSE} {$IFDEF ShowCollect} @@ -3031,7 +3031,7 @@ begin '"',GetIdentifier(Params.Identifier),'"', ' Context="',ContextNode.DescAsString,'" "',copy(Src,ContextNode.StartPos,20),'"', ' File="',ExtractFilename(MainFilename)+'"', - ' Flags=[',FindDeclarationFlagsAsString(Params.Flags),']' + ' Flags=[',dbgs(Params.Flags),']' ]); end; {$ENDIF} @@ -3054,7 +3054,7 @@ begin DebugLn('[TFindDeclarationTool.FindIdentifierInContext] Loop Ident=', '"',GetIdentifier(Params.Identifier),'"', ' Context="',ContextNode.DescAsString,'" "',copy(Src,ContextNode.StartPos,20),'"', - ' Flags=[',FindDeclarationFlagsAsString(Params.Flags),']' + ' Flags=[',dbgs(Params.Flags),']' ); {$ELSE} {$IFDEF ShowCollect} @@ -3062,7 +3062,7 @@ begin DebugLn('[TFindDeclarationTool.FindIdentifierInContext] COLLECT Loop Ident=', '"',GetIdentifier(Params.Identifier),'"', ' Context="',ContextNode.DescAsString,'" "',copy(Src,ContextNode.StartPos,20),'"', - ' Flags=[',FindDeclarationFlagsAsString(Params.Flags),']' + ' Flags=[',dbgs(Params.Flags),']' ); end; {$ENDIF}