diff --git a/components/codetools/finddeclarationtool.pas b/components/codetools/finddeclarationtool.pas index 0475a81dd3..5dbf5f3a5d 100644 --- a/components/codetools/finddeclarationtool.pas +++ b/components/codetools/finddeclarationtool.pas @@ -7191,15 +7191,20 @@ var ProcNode: TCodeTreeNode; ClassOfMethodContext: TFindContext; HasIdentifier: Boolean; + Context: TFindContext; begin // for example: inherited A; // inherited skips the class and begins to search in the ancestor class - if (ExprType.Context.Node<>StartNode) or (ExprType.Context.Node=nil) - then begin + if ExprType.Desc=xtNone then + Context:=CreateFindContext(Self,StartNode) + else + Context:=ExprType.Context; + + if (Context.Node<>StartNode) or (Context.Node=nil) then begin MoveCursorToCleanPos(CurAtom.StartPos); RaiseIllegalQualifierFound; end; - if (not NodeIsInAMethod(ExprType.Context.Node)) then begin + if (not NodeIsInAMethod(Context.Node)) then begin MoveCursorToCleanPos(CurAtom.StartPos); RaiseException(ctsInheritedKeywordOnlyAllowedInMethods); end; @@ -7221,11 +7226,11 @@ var {$ENDIF} // find ancestor of class of method - ProcNode:=ExprType.Context.Node.GetNodeOfType(ctnProcedure); + ProcNode:=Context.Node.GetNodeOfType(ctnProcedure); Params.Save(OldInput); Params.Flags:=[fdfExceptionOnNotFound] +fdfGlobals*Params.Flags; - ExprType.Context.Tool.FindClassOfMethod(ProcNode,Params,true); + Context.Tool.FindClassOfMethod(ProcNode,Params,true); ClassOfMethodContext:=CreateFindContext(Params); // find class ancestor @@ -7234,6 +7239,7 @@ var ClassOfMethodContext.Tool.FindAncestorOfClass(ClassOfMethodContext.Node, Params,true); + ExprType.Desc:=xtContext; if HasIdentifier then begin // search identifier only in class ancestor Params.Load(OldInput,false); diff --git a/components/codetools/ide/declarevardlg.pas b/components/codetools/ide/declarevardlg.pas index 61d38bb42f..4f43ef018a 100644 --- a/components/codetools/ide/declarevardlg.pas +++ b/components/codetools/ide/declarevardlg.pas @@ -28,9 +28,10 @@ ToDo: - guess for in - guess parameter - - guess :=expression + - guess j:= - Extend uses section when adding to a class - Fix bug: adding types with comments + - Fix bug: insert at beginning of proc, if identifier is in sub proc - Target implementation - Target interface - Target program