diff --git a/components/codetools/finddeclarationtool.pas b/components/codetools/finddeclarationtool.pas index c006a8d588..eac3f6c2e7 100644 --- a/components/codetools/finddeclarationtool.pas +++ b/components/codetools/finddeclarationtool.pas @@ -4019,23 +4019,23 @@ begin // no ancestor class specified ClassIdentNode:=ClassNode.Parent; // check class name - if (ClassIdentNode=nil) - or (not (ClassIdentNode.Desc in [ctnTypeDefinition,ctnGenericType])) then + if (ClassIdentNode<>nil) + and (not (ClassIdentNode.Desc in [ctnTypeDefinition,ctnGenericType])) then begin - MoveCursorToNodeStart(ClassNode); - RaiseException('class without name'); + ClassIdentNode:=nil; end; if ClassNode.Desc=ctnClass then begin // if this class is not TObject, TObject is class ancestor - SearchBaseClass:=not CompareSrcIdentifiers(ClassIdentNode.StartPos,'TObject'); + SearchBaseClass:=(ClassIdentNode=nil) + or (not CompareSrcIdentifiers(ClassIdentNode.StartPos,'TObject')); end else if ClassNode.Desc in AllClassInterfaces then begin // Delphi has as default interface IInterface // FPC has as default interface IUnknown and an alias IInterface = IUnknown - SearchBaseClass:= - (not CompareSrcIdentifiers(ClassIdentNode.StartPos,'IInterface')) - and (not CompareSrcIdentifiers(ClassIdentNode.StartPos,'IUnknown')); + SearchBaseClass:=(ClassIdentNode=nil) + or ((not CompareSrcIdentifiers(ClassIdentNode.StartPos,'IInterface')) + and (not CompareSrcIdentifiers(ClassIdentNode.StartPos,'IUnknown'))); end else - exit; + exit; // has no default ancestor (e.g. record) if not SearchBaseClass then exit; {$IFDEF ShowTriedContexts} diff --git a/components/codetools/identcompletiontool.pas b/components/codetools/identcompletiontool.pas index fcb099e079..c99c10cefe 100644 --- a/components/codetools/identcompletiontool.pas +++ b/components/codetools/identcompletiontool.pas @@ -1823,7 +1823,7 @@ begin fdfSearchInParentNodes,fdfSearchInAncestors]; if IgnoreCurContext then Params.Flags:=Params.Flags+[fdfIgnoreCurContextNode]; - debugln(['TIdentCompletionTool.FindCollectionContext ',fdfIgnoreCurContextNode in Params.Flags]); + //debugln(['TIdentCompletionTool.FindCollectionContext ',fdfIgnoreCurContextNode in Params.Flags]); ExprType:=FindExpressionTypeOfTerm(ContextExprStartPos,IdentStartPos, Params,false); //DebugLn(['TIdentCompletionTool.FindCollectionContext ',ExprTypeToString(ExprType)]);