mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-03 09:37:13 +01:00
codetools: checklfm: search further to find published property
git-svn-id: trunk@34805 -
This commit is contained in:
parent
6eee8de8d2
commit
380ab6721d
@ -2102,6 +2102,7 @@ var
|
|||||||
function FindNonPublishedDefineProperty(LFMNode: TLFMTreeNode;
|
function FindNonPublishedDefineProperty(LFMNode: TLFMTreeNode;
|
||||||
DefaultErrorPosition: integer;
|
DefaultErrorPosition: integer;
|
||||||
const IdentName: string; const ClassContext: TFindContext): boolean;
|
const IdentName: string; const ClassContext: TFindContext): boolean;
|
||||||
|
// properties can be defined via DefineProperties
|
||||||
var
|
var
|
||||||
PropertyNode: TLFMPropertyNode;
|
PropertyNode: TLFMPropertyNode;
|
||||||
ObjectNode: TLFMObjectNode;
|
ObjectNode: TLFMObjectNode;
|
||||||
@ -2172,12 +2173,13 @@ var
|
|||||||
function FindLFMIdentifier(LFMNode: TLFMTreeNode;
|
function FindLFMIdentifier(LFMNode: TLFMTreeNode;
|
||||||
DefaultErrorPosition: integer;
|
DefaultErrorPosition: integer;
|
||||||
const IdentName: string; const ClassContext: TFindContext;
|
const IdentName: string; const ClassContext: TFindContext;
|
||||||
SearchAlsoInDefineProperties, ErrorOnNotFound: boolean;
|
SearchInDefinePropertiesToo, ErrorOnNotFound: boolean;
|
||||||
out IdentContext: TFindContext): boolean;
|
out IdentContext: TFindContext): boolean;
|
||||||
var
|
var
|
||||||
Params: TFindDeclarationParams;
|
Params: TFindDeclarationParams;
|
||||||
IdentifierNotPublished: Boolean;
|
IdentifierNotPublished: Boolean;
|
||||||
IsPublished: Boolean;
|
IsPublished: Boolean;
|
||||||
|
CurContext: TFindContext;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
IdentContext:=CleanFindContext;
|
IdentContext:=CleanFindContext;
|
||||||
@ -2204,37 +2206,41 @@ var
|
|||||||
);}
|
);}
|
||||||
if ClassContext.Tool.FindIdentifierInContext(Params) then begin
|
if ClassContext.Tool.FindIdentifierInContext(Params) then begin
|
||||||
Result:=true;
|
Result:=true;
|
||||||
|
IdentContext:=CleanFindContext;
|
||||||
repeat
|
repeat
|
||||||
IdentContext:=CreateFindContext(Params);
|
CurContext:=CreateFindContext(Params);
|
||||||
if (not IsPublished)
|
if (not IsPublished)
|
||||||
and (IdentContext.Node.HasParentOfType(ctnClassPublished)) then
|
and (CurContext.Node.HasParentOfType(ctnClassPublished)) then
|
||||||
IsPublished:=true;
|
IsPublished:=true;
|
||||||
|
|
||||||
if (IdentContext.Node<>nil)
|
if (IdentContext.Node=nil) then begin
|
||||||
and (IdentContext.Node.Desc=ctnProperty)
|
if (LFMNode.TheType<>lfmnProperty)
|
||||||
and (IdentContext.Tool.PropNodeIsTypeLess(IdentContext.Node)) then
|
or ((CurContext.Node.Desc=ctnProperty)
|
||||||
|
and (not CurContext.Tool.PropNodeIsTypeLess(CurContext.Node)))
|
||||||
|
then
|
||||||
|
IdentContext:=CurContext;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (IdentContext.Node<>nil) and IsPublished then break;
|
||||||
|
|
||||||
|
// search further
|
||||||
|
Params.Clear;
|
||||||
|
Params.Flags:=[fdfSearchInAncestors,
|
||||||
|
fdfIgnoreMissingParams,
|
||||||
|
fdfIgnoreCurContextNode,
|
||||||
|
fdfIgnoreOverloadedProcs];
|
||||||
|
Params.ContextNode:=CurContext.Node.Parent;
|
||||||
|
while (Params.ContextNode<>nil)
|
||||||
|
and (not (Params.ContextNode.Desc in AllClasses)) do
|
||||||
|
Params.ContextNode:=Params.ContextNode.Parent;
|
||||||
|
if Params.ContextNode=nil then break;
|
||||||
|
Params.SetIdentifier(ClassContext.Tool,PChar(Pointer(IdentName)),nil);
|
||||||
|
if not CurContext.Tool.FindIdentifierInContext(Params) then
|
||||||
begin
|
begin
|
||||||
// this is a typeless property -> search further
|
DebugLn(['FindLFMIdentifier ERROR ancestor of '+LFMNode.GetPath+' not found: ',FindContextToString(IdentContext),' IdentName=',IdentName]);
|
||||||
Params.Clear;
|
|
||||||
Params.Flags:=[fdfSearchInAncestors,
|
|
||||||
fdfIgnoreMissingParams,
|
|
||||||
fdfIgnoreCurContextNode,
|
|
||||||
fdfIgnoreOverloadedProcs];
|
|
||||||
Params.ContextNode:=IdentContext.Node.Parent;
|
|
||||||
while (Params.ContextNode<>nil)
|
|
||||||
and (not (Params.ContextNode.Desc in AllClasses)) do
|
|
||||||
Params.ContextNode:=Params.ContextNode.Parent;
|
|
||||||
if Params.ContextNode<>nil then begin
|
|
||||||
Params.SetIdentifier(ClassContext.Tool,PChar(Pointer(IdentName)),nil);
|
|
||||||
if not IdentContext.Tool.FindIdentifierInContext(Params) then
|
|
||||||
begin
|
|
||||||
DebugLn(['FindLFMIdentifier ERROR ancestor of property not found: ',FindContextToString(IdentContext),' IdentName=',IdentName]);
|
|
||||||
break;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end else
|
|
||||||
break;
|
break;
|
||||||
until false;
|
end;
|
||||||
|
until Params.NewNode=nil;
|
||||||
end;
|
end;
|
||||||
except
|
except
|
||||||
// ignore search/parse errors
|
// ignore search/parse errors
|
||||||
@ -2249,8 +2255,8 @@ var
|
|||||||
if (IdentContext.Node=nil) or IdentifierNotPublished then begin
|
if (IdentContext.Node=nil) or IdentifierNotPublished then begin
|
||||||
// no proper node found
|
// no proper node found
|
||||||
// -> search in DefineProperties
|
// -> search in DefineProperties
|
||||||
if SearchAlsoInDefineProperties then begin
|
if SearchInDefinePropertiesToo then begin
|
||||||
//debugln('FindLFMIdentifier A SearchAlsoInDefineProperties=',dbgs(SearchAlsoInDefineProperties));
|
//debugln('FindLFMIdentifier A SearchAlsoInDefineProperties=',dbgs(SearchInDefinePropertiesToo));
|
||||||
if FindNonPublishedDefineProperty(LFMNode,DefaultErrorPosition,
|
if FindNonPublishedDefineProperty(LFMNode,DefaultErrorPosition,
|
||||||
IdentName,ClassContext)
|
IdentName,ClassContext)
|
||||||
then begin
|
then begin
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user