mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 17:01:35 +02:00
codetools: property completion: fixed check if store accessor with index specififer exists
git-svn-id: branches/fixes_1_8@55916 -
This commit is contained in:
parent
d9f1dd6721
commit
ba14cba819
@ -479,6 +479,7 @@ function TCodeCompletionCodeTool.FindProcInCodeCompleteClass(
|
|||||||
// NameAndParams should be uppercase and contains the proc name and the
|
// NameAndParams should be uppercase and contains the proc name and the
|
||||||
// parameter list without names and default values
|
// parameter list without names and default values
|
||||||
// and should not contain any comments and no result type
|
// and should not contain any comments and no result type
|
||||||
|
// e.g. DOIT(LONGINT;STRING)
|
||||||
var
|
var
|
||||||
ANodeExt: TCodeTreeNodeExtension;
|
ANodeExt: TCodeTreeNodeExtension;
|
||||||
Params: TFindDeclarationParams;
|
Params: TFindDeclarationParams;
|
||||||
@ -7550,28 +7551,40 @@ var
|
|||||||
end else
|
end else
|
||||||
AccessParam:=PropName
|
AccessParam:=PropName
|
||||||
+BeautifyCodeOpts.PropertyStoredIdentPostfix;
|
+BeautifyCodeOpts.PropertyStoredIdentPostfix;
|
||||||
CleanAccessFunc:=UpperCaseStr(AccessParam);
|
if (Parts[ppIndexWord].StartPos<1) then begin
|
||||||
// check if procedure exists
|
// no index -> check if method or field exists
|
||||||
if (not ProcExistsInCodeCompleteClass(CleanAccessFunc+';'))
|
CleanAccessFunc:=UpperCaseStr(AccessParam);
|
||||||
and (not VarExistsInCodeCompleteClass(CleanAccessFunc))
|
if (not ProcExistsInCodeCompleteClass(CleanAccessFunc+';'))
|
||||||
then begin
|
and (not VarExistsInCodeCompleteClass(CleanAccessFunc))
|
||||||
// add insert demand for function
|
then begin
|
||||||
// build function code
|
// add insert demand for function
|
||||||
if Parts[ppIndexWord].StartPos < 1 then begin
|
// build function code
|
||||||
// no index
|
|
||||||
AccessFunc := 'function ' + AccessParam + ':Boolean;';
|
AccessFunc := 'function ' + AccessParam + ':Boolean;';
|
||||||
CleanAccessFunc := CleanAccessFunc+';';
|
CleanAccessFunc := CleanAccessFunc+';';
|
||||||
end else begin
|
if IsClassProp then
|
||||||
// index
|
AccessFunc:='class '+AccessFunc+' static;';;
|
||||||
|
// add new Insert Node
|
||||||
|
if CompleteProperties then
|
||||||
|
AddClassInsertion(CleanAccessFunc,AccessFunc,AccessParam,
|
||||||
|
ncpPrivateProcs,PropNode);
|
||||||
|
end;
|
||||||
|
end else begin
|
||||||
|
// has index specifier -> check if method exists
|
||||||
|
CleanAccessFunc:=UpperCaseStr(AccessParam);
|
||||||
|
if (not ProcExistsInCodeCompleteClass(CleanAccessFunc+'('+UpperCaseStr(IndexType)+');'))
|
||||||
|
and (not VarExistsInCodeCompleteClass(CleanAccessFunc))
|
||||||
|
then begin
|
||||||
|
// add insert demand for function
|
||||||
|
// build function code
|
||||||
AccessFunc := 'function ' + AccessParam + '(AIndex:'+IndexType+'):Boolean;';
|
AccessFunc := 'function ' + AccessParam + '(AIndex:'+IndexType+'):Boolean;';
|
||||||
CleanAccessFunc := UpperCaseStr(CleanAccessFunc + '('+IndexType+');');
|
CleanAccessFunc := UpperCaseStr(CleanAccessFunc + '('+IndexType+');');
|
||||||
|
if IsClassProp then
|
||||||
|
AccessFunc:='class '+AccessFunc+' static;';;
|
||||||
|
// add new Insert Node
|
||||||
|
if CompleteProperties then
|
||||||
|
AddClassInsertion(CleanAccessFunc,AccessFunc,AccessParam,
|
||||||
|
ncpPrivateProcs,PropNode);
|
||||||
end;
|
end;
|
||||||
if IsClassProp then
|
|
||||||
AccessFunc:='class '+AccessFunc+' static;';;
|
|
||||||
// add new Insert Node
|
|
||||||
if CompleteProperties then
|
|
||||||
AddClassInsertion(CleanAccessFunc,AccessFunc,AccessParam,
|
|
||||||
ncpPrivateProcs,PropNode);
|
|
||||||
end;
|
end;
|
||||||
if Parts[ppStored].StartPos<0 then begin
|
if Parts[ppStored].StartPos<0 then begin
|
||||||
// insert stored specifier
|
// insert stored specifier
|
||||||
|
Loading…
Reference in New Issue
Block a user