mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 01:17:11 +02:00
codetools: find inheritance of objccategory
git-svn-id: trunk@36458 -
This commit is contained in:
parent
7aa80f1685
commit
4d57d078dd
@ -2033,6 +2033,18 @@ begin
|
||||
da_DefineRecurse));
|
||||
RTLDir.AddChild(IFTempl);
|
||||
|
||||
// rtl: IF TargetOS=iphonesim then add include path rtl/unix, rtl/macos
|
||||
IFTempl:=TDefineTemplate.Create('If TargetOS=iphonesim','If TargetOS=iphonesim',
|
||||
'',''''+TargetOSMacro+'''=''iphonesim''',da_If);
|
||||
IFTempl.AddChild(TDefineTemplate.Create('Include Path',
|
||||
Format(ctsIncludeDirectoriesPlusDirs,['unix,macos']),
|
||||
ExternalMacroStart+'IncPath',
|
||||
IncPathMacro
|
||||
+';'+Dir+'rtl'+DS+'unix'
|
||||
+';'+Dir+'rtl'+DS+'macos',
|
||||
da_DefineRecurse));
|
||||
RTLDir.AddChild(IFTempl);
|
||||
|
||||
// add processor and SrcOS alias defines for the RTL
|
||||
AddProcessorTypeDefine(RTLDir);
|
||||
AddSrcOSDefines(RTLDir);
|
||||
|
@ -2794,6 +2794,14 @@ var
|
||||
if ContextNode.Desc=ctnGenericType then begin
|
||||
NameNode:=ContextNode.FirstChild;
|
||||
if NameNode=nil then exit;
|
||||
end else
|
||||
if (ContextNode.Desc=ctnTypeDefinition)
|
||||
and Assigned(ContextNode.FirstChild)
|
||||
and (ContextNode.FirstChild.Desc=ctnObjCCategory) then begin
|
||||
NameNode:=FindInheritanceNode(ContextNode.FirstChild);
|
||||
if NameNode=nil then exit;
|
||||
NameNode:=NameNode.FirstChild;
|
||||
if NameNode=nil then exit;
|
||||
end;
|
||||
|
||||
if (fdfCollect in Params.Flags)
|
||||
@ -6127,6 +6135,27 @@ function TFindDeclarationTool.BuildInterfaceIdentifierCache(
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure ScanForExtendedClass(ParentNode: TCodeTreeNode);
|
||||
var
|
||||
Node: TCodeTreeNode;
|
||||
begin
|
||||
Node:=ParentNode.FirstChild;
|
||||
if (Node<>nil) then
|
||||
case Node.Desc of
|
||||
ctnObjCCategory:
|
||||
begin
|
||||
Node:=FindInheritanceNode(Node);
|
||||
if Assigned(Node) then begin
|
||||
Node:=Node.FirstChild;
|
||||
if Assigned(Node) then
|
||||
FInterfaceIdentifierCache.Add(@Src[Node.StartPos],
|
||||
ParentNode,ParentNode.StartPos);
|
||||
end;
|
||||
end;
|
||||
{ TODO : class helpers }
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure ScanChildren(ParentNode: TCodeTreeNode); forward;
|
||||
|
||||
procedure ScanNode(Node: TCodeTreeNode);
|
||||
@ -6138,6 +6167,7 @@ function TFindDeclarationTool.BuildInterfaceIdentifierCache(
|
||||
begin
|
||||
FInterfaceIdentifierCache.Add(@Src[Node.StartPos],Node,Node.StartPos);
|
||||
ScanForEnums(Node);
|
||||
ScanForExtendedClass(Node);
|
||||
end;
|
||||
ctnGenericType:
|
||||
if Node.FirstChild<>nil then begin
|
||||
|
@ -1884,7 +1884,7 @@ end;
|
||||
function TPascalReaderTool.FindInheritanceNode(ClassNode: TCodeTreeNode): TCodeTreeNode;
|
||||
begin
|
||||
Result:=ClassNode.FirstChild;
|
||||
while (Result<>nil) and (Result.Desc in [ctnClassSealed,ctnClassAbstract]) do
|
||||
while (Result<>nil) and (Result.Desc in [ctnClassSealed,ctnClassAbstract,ctnClassExternal]) do
|
||||
Result:=Result.NextBrother;
|
||||
if (Result<>nil) and (Result.Desc<>ctnClassInheritance) then
|
||||
Result:=nil;
|
||||
@ -2027,7 +2027,24 @@ begin
|
||||
if ProcNode.Desc<>ctnProcedure then exit;
|
||||
MoveCursorToNodeStart(ProcNode);
|
||||
ReadNextAtom;
|
||||
if UpAtomIs('CLASS') then ReadNextAtom;
|
||||
Result:=UpAtomIs('CONSTRUCTOR');
|
||||
if not Result and UpAtomIs('FUNCTION')
|
||||
and ([cmsObjectiveC1,cmsObjectiveC2]*Scanner.CompilerModeSwitches<>[]) then
|
||||
begin
|
||||
ProcNode:=ProcNode.FirstChild;
|
||||
if ProcNode=nil then exit;
|
||||
if (ProcNode.SubDesc and ctnsNeedJITParsing)>0 then
|
||||
BuildSubTreeForProcHead(ProcNode);
|
||||
ProcNode:=ProcNode.FirstChild;
|
||||
if (ProcNode=nil) then exit;
|
||||
if ProcNode.Desc=ctnParameterList then
|
||||
ProcNode:=ProcNode.NextBrother;
|
||||
if (ProcNode=nil) then exit;
|
||||
MoveCursorToNodeStart(ProcNode);
|
||||
ReadNextAtom;
|
||||
Result:=UpAtomIs('ID');
|
||||
end;
|
||||
end;
|
||||
|
||||
function TPascalReaderTool.NodeIsDestructor(ProcNode: TCodeTreeNode): boolean;
|
||||
|
@ -168,6 +168,7 @@ begin
|
||||
Add('symbian');
|
||||
Add('java');
|
||||
Add('android');
|
||||
Add('iphonesim');
|
||||
end;
|
||||
ItemIndex := 0;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user