mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 21:19:24 +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
|
if Parts[ppRead].StartPos>0 then
|
||||||
AccessParam:=copy(Src,Parts[ppRead].StartPos,
|
AccessParam:=copy(Src,Parts[ppRead].StartPos,
|
||||||
Parts[ppRead].EndPos-Parts[ppRead].StartPos)
|
Parts[ppRead].EndPos-Parts[ppRead].StartPos)
|
||||||
else
|
else begin
|
||||||
AccessParam:='';
|
|
||||||
if (Parts[ppParamList].StartPos>0) or (Parts[ppIndexWord].StartPos>0)
|
if (Parts[ppParamList].StartPos>0) or (Parts[ppIndexWord].StartPos>0)
|
||||||
or (AnsiCompareText(AccessParamPrefix,
|
or (AnsiCompareText(AccessParamPrefix,
|
||||||
LeftStr(AccessParam,length(AccessParamPrefix)))=0) then
|
LeftStr(AccessParam,length(AccessParamPrefix)))=0) then
|
||||||
begin
|
begin
|
||||||
// the read identifier is a function
|
// create the default read identifier for a function
|
||||||
if Parts[ppRead].StartPos<1 then
|
|
||||||
AccessParam:=AccessParamPrefix+copy(Src,Parts[ppName].StartPos,
|
AccessParam:=AccessParamPrefix+copy(Src,Parts[ppName].StartPos,
|
||||||
Parts[ppName].EndPos-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[ppParamList].StartPos>0) then begin
|
||||||
if (Parts[ppIndexWord].StartPos<1) then begin
|
if (Parts[ppIndexWord].StartPos<1) then begin
|
||||||
// param list, no index
|
// param list, no index
|
||||||
@ -851,8 +879,18 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
|
|||||||
CleanAccessFunc:=UpperCaseStr(AccessParam)+'(:INTEGER);';
|
CleanAccessFunc:=UpperCaseStr(AccessParam)+'(:INTEGER);';
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
// check if function exists
|
if ProcExistsInCodeCompleteClass(CleanAccessFunc) then exit;
|
||||||
if not ProcExistsInCodeCompleteClass(CleanAccessFunc) then begin
|
|
||||||
|
// 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}
|
{$IFDEF CTDEBUG}
|
||||||
writeln('[TCodeCompletionCodeTool.CompleteProperty] CleanAccessFunc ',CleanAccessFunc,' does not exist');
|
writeln('[TCodeCompletionCodeTool.CompleteProperty] CleanAccessFunc ',CleanAccessFunc,' does not exist');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -895,40 +933,12 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
|
|||||||
if CompleteProperties then
|
if CompleteProperties then
|
||||||
AddClassInsertion(PropNode,CleanAccessFunc,AccessFunc,AccessParam,
|
AddClassInsertion(PropNode,CleanAccessFunc,AccessFunc,AccessParam,
|
||||||
'',ncpPrivateProcs);
|
'',ncpPrivateProcs);
|
||||||
end;
|
|
||||||
end else begin
|
end else begin
|
||||||
// the read identifier is a variable
|
// 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;
|
VariableName:=AccessParam;
|
||||||
if not VarExistsInCodeCompleteClass(UpperCaseStr(AccessParam)) then
|
|
||||||
begin
|
|
||||||
// variable does not exist yet -> add insert demand for variable
|
// variable does not exist yet -> add insert demand for variable
|
||||||
if CompleteProperties then
|
AddClassInsertion(PropNode,UpperCaseStr(VariableName),
|
||||||
AddClassInsertion(PropNode,UpperCaseStr(AccessParam),
|
VariableName+':'+PropType+';',VariableName,'',ncpPrivateVars);
|
||||||
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;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -948,11 +958,34 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
|
|||||||
else
|
else
|
||||||
AccessParam:=AccessParamPrefix+copy(Src,Parts[ppName].StartPos,
|
AccessParam:=AccessParamPrefix+copy(Src,Parts[ppName].StartPos,
|
||||||
Parts[ppName].EndPos-Parts[ppName].StartPos);
|
Parts[ppName].EndPos-Parts[ppName].StartPos);
|
||||||
if (Parts[ppParamList].StartPos>0) or (Parts[ppIndexWord].StartPos>0)
|
|
||||||
or (AnsiCompareText(AccessParamPrefix,
|
// complete property definition for write specifier
|
||||||
LeftStr(AccessParam,length(AccessParamPrefix)))=0) then
|
if (Parts[ppWrite].StartPos<0) and CompleteProperties then begin
|
||||||
begin
|
// insert write specifier
|
||||||
// the write identifier is a procedure
|
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[ppParamList].StartPos>0) then begin
|
||||||
if (Parts[ppIndexWord].StartPos<1) then begin
|
if (Parts[ppIndexWord].StartPos<1) then begin
|
||||||
// param list, no index
|
// param list, no index
|
||||||
@ -974,8 +1007,17 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
|
|||||||
+' :'+UpperCaseStr(PropType)+');';
|
+' :'+UpperCaseStr(PropType)+');';
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
// check if procedure exists
|
if ProcExistsInCodeCompleteClass(CleanAccessFunc) then exit;
|
||||||
if not ProcExistsInCodeCompleteClass(CleanAccessFunc) then begin
|
|
||||||
|
// 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
|
// add insert demand for function
|
||||||
// build function code
|
// build function code
|
||||||
ProcBody:='';
|
ProcBody:='';
|
||||||
@ -1042,42 +1084,14 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
|
|||||||
if CompleteProperties then
|
if CompleteProperties then
|
||||||
AddClassInsertion(PropNode,CleanAccessFunc,AccessFunc,AccessParam,
|
AddClassInsertion(PropNode,CleanAccessFunc,AccessFunc,AccessParam,
|
||||||
ProcBody,ncpPrivateProcs);
|
ProcBody,ncpPrivateProcs);
|
||||||
end;
|
|
||||||
end else begin
|
end else begin
|
||||||
// the write identifier is a variable
|
// the write identifier is a variable
|
||||||
if not VarExistsInCodeCompleteClass(UpperCaseStr(AccessParam)) then
|
// -> add insert demand for variable
|
||||||
begin
|
|
||||||
// variable does not exist yet -> add insert demand for variable
|
|
||||||
if CompleteProperties then
|
if CompleteProperties then
|
||||||
AddClassInsertion(PropNode,UpperCaseStr(AccessParam),
|
AddClassInsertion(PropNode,UpperCaseStr(AccessParam),
|
||||||
AccessParam+':'+PropType+';',AccessParam,'',ncpPrivateVars);
|
AccessParam+':'+PropType+';',AccessParam,'',ncpPrivateVars);
|
||||||
end;
|
end;
|
||||||
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;
|
procedure CompleteStoredSpecifier;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user