codetools: show protected methods after the inherited keyword.

git-svn-id: trunk@52397 -
This commit is contained in:
ondrej 2016-05-27 15:35:59 +00:00
parent c377ec6c26
commit f12d1d31f1

View File

@ -414,7 +414,7 @@ type
procedure FindCollectionContext(Params: TFindDeclarationParams; procedure FindCollectionContext(Params: TFindDeclarationParams;
IdentStartPos: integer; CursorNode: TCodeTreeNode; IdentStartPos: integer; CursorNode: TCodeTreeNode;
out ExprType: TExpressionType; out ContextExprStartPos: LongInt; out ExprType: TExpressionType; out ContextExprStartPos: LongInt;
out StartInSubContext: Boolean); out StartInSubContext, HasInheritedKeyword: Boolean);
function CollectAllContexts(Params: TFindDeclarationParams; function CollectAllContexts(Params: TFindDeclarationParams;
const FoundContext: TFindContext): TIdentifierFoundResult; const FoundContext: TFindContext): TIdentifierFoundResult;
procedure AddCollectionContext(Tool: TFindDeclarationTool; procedure AddCollectionContext(Tool: TFindDeclarationTool;
@ -2045,18 +2045,18 @@ end;
procedure TIdentCompletionTool.FindCollectionContext( procedure TIdentCompletionTool.FindCollectionContext(
Params: TFindDeclarationParams; IdentStartPos: integer; Params: TFindDeclarationParams; IdentStartPos: integer;
CursorNode: TCodeTreeNode; CursorNode: TCodeTreeNode; out ExprType: TExpressionType; out
out ExprType: TExpressionType; ContextExprStartPos: LongInt; out StartInSubContext,
out ContextExprStartPos: LongInt; HasInheritedKeyword: Boolean);
out StartInSubContext: Boolean);
function GetContextExprStartPos(IdentStartPos: integer; function GetContextExprStartPos(IdentStartPos: integer;
ContextNode: TCodeTreeNode): integer; ContextNode: TCodeTreeNode): integer;
begin begin
MoveCursorToCleanPos(IdentStartPos); MoveCursorToCleanPos(IdentStartPos);
ReadPriorAtom; ReadPriorAtom;
HasInheritedKeyword := UpAtomIs('INHERITED');
if (CurPos.Flag=cafPoint) if (CurPos.Flag=cafPoint)
or UpAtomIs('INHERITED') then begin or HasInheritedKeyword then begin
Result:=FindStartOfTerm(IdentStartPos,NodeTermInType(ContextNode)); Result:=FindStartOfTerm(IdentStartPos,NodeTermInType(ContextNode));
if Result<ContextNode.StartPos then if Result<ContextNode.StartPos then
Result:=ContextNode.StartPos; Result:=ContextNode.StartPos;
@ -2576,7 +2576,7 @@ var
StartPosOfVariable: LongInt; StartPosOfVariable: LongInt;
CursorContext: TFindContext; CursorContext: TFindContext;
IdentStartXY: TCodeXYPosition; IdentStartXY: TCodeXYPosition;
InFrontOfDirective: Boolean; InFrontOfDirective, HasInheritedKeyword: Boolean;
ExprType: TExpressionType; ExprType: TExpressionType;
IdentifierPath: string; IdentifierPath: string;
@ -2675,12 +2675,15 @@ begin
GatherSourceNames(GatherContext); GatherSourceNames(GatherContext);
end else begin end else begin
FindCollectionContext(Params,IdentStartPos,CursorNode, FindCollectionContext(Params,IdentStartPos,CursorNode,
ExprType,ContextExprStartPos,StartInSubContext); ExprType,ContextExprStartPos,StartInSubContext,
HasInheritedKeyword);
//debugln(['TIdentCompletionTool.GatherIdentifiers FindCollectionContext ',ExprTypeToString(ExprType)]); //debugln(['TIdentCompletionTool.GatherIdentifiers FindCollectionContext ',ExprTypeToString(ExprType)]);
GatherContext := ExprType.Context; GatherContext := ExprType.Context;
if GatherContext.Node<>nil then
DebugLn('%d:%d', [GatherContext.Node.StartPos, GatherContext.Node.EndPos]);
// find class and ancestors if existing (needed for protected identifiers) // find class and ancestors if existing (needed for protected identifiers)
if GatherContext.Tool = Self then if (GatherContext.Tool = Self) or HasInheritedKeyword then
begin begin
FindContextClassAndAncestorsAndExtendedClassOfHelper(IdentStartXY, FICTClassAndAncestorsAndExtClassOfHelper); FindContextClassAndAncestorsAndExtendedClassOfHelper(IdentStartXY, FICTClassAndAncestorsAndExtClassOfHelper);
end; end;
@ -2981,7 +2984,7 @@ var
VarNameAtom, ProcNameAtom: TAtomPosition; VarNameAtom, ProcNameAtom: TAtomPosition;
ParameterIndex: integer; ParameterIndex: integer;
ContextExprStartPos: LongInt; ContextExprStartPos: LongInt;
StartInSubContext: Boolean; StartInSubContext, HasInheritedKeyword: Boolean;
ExprType: TExpressionType; ExprType: TExpressionType;
begin begin
Result:=false; Result:=false;
@ -3022,7 +3025,8 @@ var
CurrentIdentifierContexts.EndPos:=SrcLen+1; CurrentIdentifierContexts.EndPos:=SrcLen+1;
FindCollectionContext(Params,ProcNameAtom.StartPos,CursorNode, FindCollectionContext(Params,ProcNameAtom.StartPos,CursorNode,
ExprType,ContextExprStartPos,StartInSubContext); ExprType,ContextExprStartPos,StartInSubContext,
HasInheritedKeyword);
if ContextExprStartPos=0 then ; if ContextExprStartPos=0 then ;
{$IFDEF VerboseCodeContext} {$IFDEF VerboseCodeContext}