codetools: FindProcNode: read name of a class operator

git-svn-id: trunk@34887 -
This commit is contained in:
mattias 2012-01-23 18:07:14 +00:00
parent 0ba4bd89c0
commit b09a26670a
3 changed files with 15 additions and 9 deletions

View File

@ -346,7 +346,7 @@ begin
// find CodeTreeNode at cursor
CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true);
{$IFDEF CTDEBUG}
DebugLn('TMethodJumpingCodeTool.FindJumpPoint C ',NodeDescriptionAsString(CursorNode.Desc));
DebugLn('TMethodJumpingCodeTool.FindJumpPoint CursorNode=',CursorNode.DescAsString);
{$ENDIF}
// first test if in a class
ClassNode:=CursorNode.GetNodeOfTypes([ctnClass,ctnClassInterface,
@ -359,7 +359,7 @@ begin
// and then jumping is a nide feature
// => search in all implemented class procedures for the body
{$IFDEF CTDEBUG}
DebugLn('TMethodJumpingCodeTool.FindJumpPoint D ',NodeDescriptionAsString(ClassNode.Desc));
DebugLn('TMethodJumpingCodeTool.FindJumpPoint ClasNode=',ClassNode.DescAsString);
{$ENDIF}
if (ClassNode.SubDesc and ctnsForwardDeclaration)>0 then exit;
// parse class and build CodeTreeNodes for all properties/methods

View File

@ -1158,8 +1158,8 @@ begin
end;
end;
// read procedure head
IsOperator:=UpAtomIs('OPERATOR');
IsFunction:=UpAtomIs('FUNCTION');
IsOperator:=(not IsFunction) and UpAtomIs('OPERATOR');
// read name
ReadNextAtom;
if (not IsOperator)
@ -2560,8 +2560,8 @@ begin
if CurSection=ctnInterface then
ProcNode.SubDesc:=ctnsForwardDeclaration;
end;
IsOperator:=UpAtomIs('OPERATOR');
IsFunction:=UpAtomIs('FUNCTION');
IsOperator:=(not IsFunction) and UpAtomIs('OPERATOR');
IsMethod:=False;
ReadNextAtom;// read first atom of head (= name/operator + parameterlist + resulttype;)
if (not IsOperator)
@ -5300,7 +5300,7 @@ begin
if UpAtomIs('CLASS') then
ReadNextAtom;
IsFunction:=UpAtomIs('FUNCTION');
IsOperator:=UpAtomIs('OPERATOR');
IsOperator:=(not IsFunction) and UpAtomIs('OPERATOR');
IsProcType:=ProcNode.Desc=ctnProcedureType;
// read procedure head (= [name] + parameterlist + resulttype;)
ReadNextAtom;// read first atom of head

View File

@ -458,7 +458,9 @@ begin
ExtractProcHeadPos:=phepStart;
if not IsProcType then begin
// read name
if (not IsOperator) and (not AtomIsIdentifier(false)) then exit;
if ((not IsOperator)
or (not WordIsCustomOperator.DoItCaseInsensitive(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)))
and (not AtomIsIdentifier(false)) then exit;
if TheClassName<>'' then begin
s:=TheClassName+'.';
@ -483,7 +485,9 @@ begin
end;
if CurPos.Flag<>cafPoint then break;
ExtractNextAtom(true,Attr);
if not AtomIsIdentifier(false) then exit;
if ((not IsOperator)
or (not WordIsCustomOperator.DoItCaseInsensitive(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)))
and (not AtomIsIdentifier(false)) then exit;
until false;
end else begin
// read only part of name
@ -502,7 +506,9 @@ begin
ExtractNextAtom(not (phpWithoutClassName in Attr),Attr);
// read '.'
ExtractNextAtom(not (phpWithoutClassName in Attr),Attr);
if not AtomIsIdentifier(false) then break;
if ((not IsOperator)
or (not WordIsCustomOperator.DoItCaseInsensitive(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)))
and (not AtomIsIdentifier(false)) then exit;
end else begin
// read name
ExtractNextAtom(not (phpWithoutName in Attr),Attr);
@ -686,7 +692,7 @@ begin
and (FindProcBody(Result)<>nil))) then
begin
CurProcHead:=ExtractProcHead(Result,Attr);
//DebugLn('TPascalReaderTool.FindProcNode B "',CurProcHead,'" =? "',AProcHead,'"');
//DebugLn(['TPascalReaderTool.FindProcNode B "',CurProcHead,'" =? "',AProcHead,'" Result=',CompareTextIgnoringSpace(CurProcHead,AProcHead,false)]);
if (CurProcHead<>'')
and (CompareTextIgnoringSpace(CurProcHead,AProcHead,false)=0) then
exit;