mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 13:39:30 +02:00
codetools: identifier completion after inherited, bug #10560
git-svn-id: trunk@19605 -
This commit is contained in:
parent
a258bd419f
commit
ee6cc0c5be
@ -1730,7 +1730,9 @@ begin
|
||||
NewX:=NewPos.X;
|
||||
NewY:=NewPos.Y;
|
||||
NewCode:=NewPos.Code;
|
||||
{$IFDEF CTDEBUG}
|
||||
debugln(['TCodeToolManager.FindDeclaration ',DbgsCXY(NewPos)]);
|
||||
{$ENDIF}
|
||||
end;
|
||||
{$IFDEF DoNotHandleFindDeclException}
|
||||
finally
|
||||
|
@ -5997,6 +5997,7 @@ var
|
||||
var
|
||||
ProcNode: TCodeTreeNode;
|
||||
ClassOfMethodContext: TFindContext;
|
||||
HasIdentifier: Boolean;
|
||||
begin
|
||||
// for example: inherited A;
|
||||
// inherited skips the class and begins to search in the ancestor class
|
||||
@ -6009,7 +6010,9 @@ var
|
||||
MoveCursorToCleanPos(CurAtom.StartPos);
|
||||
RaiseException(ctsInheritedKeywordOnlyAllowedInMethods);
|
||||
end;
|
||||
if not (NextAtomType in [vatIdentifier,vatPreDefIdentifier]) then
|
||||
HasIdentifier:=NextAtom.EndPos<=EndPos;
|
||||
if HasIdentifier then begin
|
||||
if (not (NextAtomType in [vatIdentifier,vatPreDefIdentifier])) then
|
||||
begin
|
||||
MoveCursorToCleanPos(NextAtom.StartPos);
|
||||
ReadNextAtom;
|
||||
@ -6017,6 +6020,7 @@ var
|
||||
end;
|
||||
|
||||
ReadNextExpressionAtom;
|
||||
end;
|
||||
{$IFDEF ShowExprEval}
|
||||
DebugLn(' ResolveINHERITED CurAtomType=',
|
||||
VariableAtomTypeNames[CurAtomType],
|
||||
@ -6037,6 +6041,7 @@ var
|
||||
ClassOfMethodContext.Tool.FindAncestorOfClass(ClassOfMethodContext.Node,
|
||||
Params,true);
|
||||
|
||||
if HasIdentifier then begin
|
||||
// search identifier only in class ancestor
|
||||
Params.Load(OldInput,false);
|
||||
Params.SetIdentifier(Self,@Src[CurAtom.StartPos],@CheckSrcIdentifier);
|
||||
@ -6048,6 +6053,11 @@ var
|
||||
Params.Load(OldInput,true);
|
||||
|
||||
ResolveBaseTypeOfIdentifier;
|
||||
end else begin
|
||||
// the keyword 'inherited' is the last atom
|
||||
// return the ancestor class context
|
||||
ExprType.Context:=CreateFindContext(Params);
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
@ -6063,6 +6073,9 @@ begin
|
||||
{$ENDIF}
|
||||
|
||||
if not InitAtomQueue then exit;
|
||||
{$IFDEF ShowExprEval}
|
||||
DebugLn(['TFindDeclarationTool.FindExpressionTypeOfVariable Expression="',copy(Src,StartPos,EndPos-StartPos),'"']);
|
||||
{$ENDIF}
|
||||
ExprType.Desc:=xtContext;
|
||||
ExprType.SubDesc:=xtNone;
|
||||
ExprType.Context:=StartContext;
|
||||
|
Loading…
Reference in New Issue
Block a user