mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 13:09:20 +02:00
changed macro name ProjectDir to ProjPath
git-svn-id: trunk@3153 -
This commit is contained in:
parent
602eb57081
commit
a49177e24f
@ -823,16 +823,44 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
|
||||
if Parts[ppRead].StartPos>0 then
|
||||
AccessParam:=copy(Src,Parts[ppRead].StartPos,
|
||||
Parts[ppRead].EndPos-Parts[ppRead].StartPos)
|
||||
else
|
||||
AccessParam:='';
|
||||
else begin
|
||||
if (Parts[ppParamList].StartPos>0) or (Parts[ppIndexWord].StartPos>0)
|
||||
or (AnsiCompareText(AccessParamPrefix,
|
||||
LeftStr(AccessParam,length(AccessParamPrefix)))=0) then
|
||||
begin
|
||||
// the read identifier is a function
|
||||
if Parts[ppRead].StartPos<1 then
|
||||
// create the default read identifier for a function
|
||||
AccessParam:=AccessParamPrefix+copy(Src,Parts[ppName].StartPos,
|
||||
Parts[ppName].EndPos-Parts[ppName].StartPos);
|
||||
end else begin
|
||||
// create the default read identifier for a variable
|
||||
AccessParam:=BeautifyCodeOpts.PrivatVariablePrefix
|
||||
+copy(Src,Parts[ppName].StartPos,
|
||||
Parts[ppName].EndPos-Parts[ppName].StartPos);
|
||||
end;
|
||||
end;
|
||||
|
||||
// complete read identifier in property definition
|
||||
if (Parts[ppRead].StartPos<0) and CompleteProperties then begin
|
||||
// insert read specifier
|
||||
if Parts[ppReadWord].StartPos>0 then begin
|
||||
// 'read' keyword exists -> insert read identifier behind
|
||||
InsertPos:=Parts[ppReadWord].EndPos;
|
||||
ASourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos,
|
||||
AccessParam);
|
||||
end else begin
|
||||
// 'read' keyword does not exist -> insert behind index and type
|
||||
if Parts[ppIndexWord].StartPos>0 then
|
||||
InsertPos:=Parts[ppIndexWord].EndPos
|
||||
else if Parts[ppIndex].StartPos>0 then
|
||||
InsertPos:=Parts[ppIndex].EndPos
|
||||
else
|
||||
InsertPos:=Parts[ppType].EndPos;
|
||||
ASourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos,
|
||||
BeautifyCodeOpts.BeautifyKeyWord('read')+' '+AccessParam);
|
||||
end;
|
||||
end;
|
||||
|
||||
// check if read access method exists
|
||||
if (Parts[ppParamList].StartPos>0) then begin
|
||||
if (Parts[ppIndexWord].StartPos<1) then begin
|
||||
// param list, no index
|
||||
@ -851,8 +879,18 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
|
||||
CleanAccessFunc:=UpperCaseStr(AccessParam)+'(:INTEGER);';
|
||||
end;
|
||||
end;
|
||||
// check if function exists
|
||||
if not ProcExistsInCodeCompleteClass(CleanAccessFunc) then begin
|
||||
if ProcExistsInCodeCompleteClass(CleanAccessFunc) then exit;
|
||||
|
||||
// check if read access variable exists
|
||||
if (Parts[ppParamList].StartPos<1) and (Parts[ppIndexWord].StartPos<1)
|
||||
and VarExistsInCodeCompleteClass(UpperCaseStr(AccessParam)) then exit;
|
||||
|
||||
// complete read access specifier
|
||||
if (Parts[ppParamList].StartPos>0) or (Parts[ppIndexWord].StartPos>0)
|
||||
or (AnsiCompareText(AccessParamPrefix,
|
||||
LeftStr(AccessParam,length(AccessParamPrefix)))=0) then
|
||||
begin
|
||||
// the read identifier is a function
|
||||
{$IFDEF CTDEBUG}
|
||||
writeln('[TCodeCompletionCodeTool.CompleteProperty] CleanAccessFunc ',CleanAccessFunc,' does not exist');
|
||||
{$ENDIF}
|
||||
@ -895,40 +933,12 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
|
||||
if CompleteProperties then
|
||||
AddClassInsertion(PropNode,CleanAccessFunc,AccessFunc,AccessParam,
|
||||
'',ncpPrivateProcs);
|
||||
end;
|
||||
end else begin
|
||||
// the read identifier is a variable
|
||||
if Parts[ppRead].StartPos<1 then
|
||||
AccessParam:=BeautifyCodeOpts.PrivatVariablePrefix
|
||||
+copy(Src,Parts[ppName].StartPos,
|
||||
Parts[ppName].EndPos-Parts[ppName].StartPos);
|
||||
VariableName:=AccessParam;
|
||||
if not VarExistsInCodeCompleteClass(UpperCaseStr(AccessParam)) then
|
||||
begin
|
||||
// variable does not exist yet -> add insert demand for variable
|
||||
if CompleteProperties then
|
||||
AddClassInsertion(PropNode,UpperCaseStr(AccessParam),
|
||||
AccessParam+':'+PropType+';',AccessParam,'',ncpPrivateVars);
|
||||
end;
|
||||
end;
|
||||
if (Parts[ppRead].StartPos<0) and CompleteProperties then begin
|
||||
// insert read specifier
|
||||
if Parts[ppReadWord].StartPos>0 then begin
|
||||
// 'read' keyword exists -> insert read identifier behind
|
||||
InsertPos:=Parts[ppReadWord].EndPos;
|
||||
ASourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos,
|
||||
AccessParam);
|
||||
end else begin
|
||||
// 'read' keyword does not exist -> insert behind index and type
|
||||
if Parts[ppIndexWord].StartPos>0 then
|
||||
InsertPos:=Parts[ppIndexWord].EndPos
|
||||
else if Parts[ppIndex].StartPos>0 then
|
||||
InsertPos:=Parts[ppIndex].EndPos
|
||||
else
|
||||
InsertPos:=Parts[ppType].EndPos;
|
||||
ASourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos,
|
||||
BeautifyCodeOpts.BeautifyKeyWord('read')+' '+AccessParam);
|
||||
end;
|
||||
AddClassInsertion(PropNode,UpperCaseStr(VariableName),
|
||||
VariableName+':'+PropType+';',VariableName,'',ncpPrivateVars);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -948,11 +958,34 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
|
||||
else
|
||||
AccessParam:=AccessParamPrefix+copy(Src,Parts[ppName].StartPos,
|
||||
Parts[ppName].EndPos-Parts[ppName].StartPos);
|
||||
if (Parts[ppParamList].StartPos>0) or (Parts[ppIndexWord].StartPos>0)
|
||||
or (AnsiCompareText(AccessParamPrefix,
|
||||
LeftStr(AccessParam,length(AccessParamPrefix)))=0) then
|
||||
begin
|
||||
// the write identifier is a procedure
|
||||
|
||||
// complete property definition for write specifier
|
||||
if (Parts[ppWrite].StartPos<0) and CompleteProperties then begin
|
||||
// insert write specifier
|
||||
if Parts[ppWriteWord].StartPos>0 then begin
|
||||
// 'write' keyword exists -> insert write identifier behind
|
||||
InsertPos:=Parts[ppWriteWord].EndPos;
|
||||
ASourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos,
|
||||
AccessParam);
|
||||
end else begin
|
||||
// 'write' keyword does not exist
|
||||
// -> insert behind type, index and write specifier
|
||||
if Parts[ppRead].StartPos>0 then
|
||||
InsertPos:=Parts[ppRead].EndPos
|
||||
else if Parts[ppReadWord].StartPos>0 then
|
||||
InsertPos:=Parts[ppReadWord].EndPos
|
||||
else if Parts[ppIndexWord].StartPos>0 then
|
||||
InsertPos:=Parts[ppIndexWord].EndPos
|
||||
else if Parts[ppIndex].StartPos>0 then
|
||||
InsertPos:=Parts[ppIndex].EndPos
|
||||
else
|
||||
InsertPos:=Parts[ppType].EndPos;
|
||||
ASourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos,
|
||||
BeautifyCodeOpts.BeautifyKeyWord('write')+' '+AccessParam);
|
||||
end;
|
||||
end;
|
||||
|
||||
// check if write method exists
|
||||
if (Parts[ppParamList].StartPos>0) then begin
|
||||
if (Parts[ppIndexWord].StartPos<1) then begin
|
||||
// param list, no index
|
||||
@ -974,8 +1007,17 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
|
||||
+' :'+UpperCaseStr(PropType)+');';
|
||||
end;
|
||||
end;
|
||||
// check if procedure exists
|
||||
if not ProcExistsInCodeCompleteClass(CleanAccessFunc) then begin
|
||||
if ProcExistsInCodeCompleteClass(CleanAccessFunc) then exit;
|
||||
|
||||
// check if write variable exists
|
||||
if (Parts[ppParamList].StartPos<1) and (Parts[ppIndexWord].StartPos<1)
|
||||
and VarExistsInCodeCompleteClass(UpperCaseStr(AccessParam)) then exit;
|
||||
|
||||
// complete class
|
||||
if (Parts[ppParamList].StartPos>0) or (Parts[ppIndexWord].StartPos>0)
|
||||
or (AnsiCompareText(AccessParamPrefix,
|
||||
LeftStr(AccessParam,length(AccessParamPrefix)))=0) then
|
||||
begin
|
||||
// add insert demand for function
|
||||
// build function code
|
||||
ProcBody:='';
|
||||
@ -1042,42 +1084,14 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
|
||||
if CompleteProperties then
|
||||
AddClassInsertion(PropNode,CleanAccessFunc,AccessFunc,AccessParam,
|
||||
ProcBody,ncpPrivateProcs);
|
||||
end;
|
||||
end else begin
|
||||
// the write identifier is a variable
|
||||
if not VarExistsInCodeCompleteClass(UpperCaseStr(AccessParam)) then
|
||||
begin
|
||||
// variable does not exist yet -> add insert demand for variable
|
||||
// -> add insert demand for variable
|
||||
if CompleteProperties then
|
||||
AddClassInsertion(PropNode,UpperCaseStr(AccessParam),
|
||||
AccessParam+':'+PropType+';',AccessParam,'',ncpPrivateVars);
|
||||
end;
|
||||
end;
|
||||
if (Parts[ppWrite].StartPos<0) and CompleteProperties then begin
|
||||
// insert write specifier
|
||||
if Parts[ppWriteWord].StartPos>0 then begin
|
||||
// 'write' keyword exists -> insert write identifier behind
|
||||
InsertPos:=Parts[ppWriteWord].EndPos;
|
||||
ASourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos,
|
||||
AccessParam);
|
||||
end else begin
|
||||
// 'write' keyword does not exist
|
||||
// -> insert behind type, index and write specifier
|
||||
if Parts[ppRead].StartPos>0 then
|
||||
InsertPos:=Parts[ppRead].EndPos
|
||||
else if Parts[ppReadWord].StartPos>0 then
|
||||
InsertPos:=Parts[ppReadWord].EndPos
|
||||
else if Parts[ppIndexWord].StartPos>0 then
|
||||
InsertPos:=Parts[ppIndexWord].EndPos
|
||||
else if Parts[ppIndex].StartPos>0 then
|
||||
InsertPos:=Parts[ppIndex].EndPos
|
||||
else
|
||||
InsertPos:=Parts[ppType].EndPos;
|
||||
ASourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos,
|
||||
BeautifyCodeOpts.BeautifyKeyWord('write')+' '+AccessParam);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure CompleteStoredSpecifier;
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user