mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-21 15:48:28 +02:00
codetools: ExtractProcHead: phpAddParentProcs
git-svn-id: trunk@52683 -
This commit is contained in:
parent
f98984edfb
commit
c2aed806b6
@ -52,6 +52,7 @@ type
|
|||||||
phpWithStart, // proc keyword e.g. 'function', 'class procedure'
|
phpWithStart, // proc keyword e.g. 'function', 'class procedure'
|
||||||
phpWithoutClassKeyword,// without 'class' proc keyword
|
phpWithoutClassKeyword,// without 'class' proc keyword
|
||||||
phpAddClassName, // extract/add 'ClassName.'
|
phpAddClassName, // extract/add 'ClassName.'
|
||||||
|
phpAddParentProcs, // add 'ProcName.' for nested procs
|
||||||
phpWithoutClassName, // skip classname
|
phpWithoutClassName, // skip classname
|
||||||
phpWithoutName, // skip function name
|
phpWithoutName, // skip function name
|
||||||
phpWithoutGenericParams,// skip <> after proc name
|
phpWithoutGenericParams,// skip <> after proc name
|
||||||
|
@ -586,8 +586,19 @@ var
|
|||||||
IsFunction: Boolean;
|
IsFunction: Boolean;
|
||||||
IsOperator: Boolean;
|
IsOperator: Boolean;
|
||||||
EndPos: Integer;
|
EndPos: Integer;
|
||||||
|
ParentNode: TCodeTreeNode;
|
||||||
const
|
const
|
||||||
SemiColon : char = ';';
|
SemiColon : char = ';';
|
||||||
|
|
||||||
|
procedure PrependName(const Prepend: string; var aPath: string);
|
||||||
|
begin
|
||||||
|
if Prepend='' then exit;
|
||||||
|
if aPath<>'' then
|
||||||
|
aPath:=Prepend+'.'+aPath
|
||||||
|
else
|
||||||
|
aPath:=Prepend;
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:='';
|
Result:='';
|
||||||
ExtractProcHeadPos:=phepNone;
|
ExtractProcHeadPos:=phepNone;
|
||||||
@ -596,14 +607,27 @@ begin
|
|||||||
ProcNode:=ProcNode.Parent;
|
ProcNode:=ProcNode.Parent;
|
||||||
if ProcNode=nil then exit;
|
if ProcNode=nil then exit;
|
||||||
end;
|
end;
|
||||||
if (ProcNode.Desc<>ctnProcedure) and (ProcNode.Desc<>ctnProcedureType) then
|
if ProcNode.Desc=ctnProcedure then
|
||||||
|
IsProcType:=false
|
||||||
|
else if ProcNode.Desc=ctnProcedureType then
|
||||||
|
IsProcType:=true
|
||||||
|
else
|
||||||
exit;
|
exit;
|
||||||
IsProcType:=(ProcNode.Desc=ctnProcedureType);
|
|
||||||
|
TheClassName:='';
|
||||||
|
|
||||||
|
if (phpAddParentProcs in Attr) and (ProcNode.Parent.Desc=ctnProcedure) then begin
|
||||||
|
// local proc
|
||||||
|
ParentNode:=ProcNode.Parent;
|
||||||
|
while ParentNode.Desc=ctnProcedure do begin
|
||||||
|
PrependName(ExtractProcName(ParentNode,Attr*[phpInUpperCase]),TheClassName);
|
||||||
|
ParentNode:=ParentNode.Parent;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
// build full class name
|
// build full class name
|
||||||
TheClassName:='';
|
|
||||||
if ([phpAddClassname,phpWithoutClassName]*Attr=[phpAddClassName]) then
|
if ([phpAddClassname,phpWithoutClassName]*Attr=[phpAddClassName]) then
|
||||||
TheClassName:=ExtractClassName(ProcNode,phpInUpperCase in Attr,true);
|
PrependName(ExtractClassName(ProcNode,phpInUpperCase in Attr,true),TheClassName);
|
||||||
|
|
||||||
// reparse the clean source
|
// reparse the clean source
|
||||||
InitExtraction;
|
InitExtraction;
|
||||||
|
Loading…
Reference in New Issue
Block a user