From e5ff2b2deffbbb0364c39707250a09bf0c6da46e Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 28 Nov 2010 13:28:54 +0000 Subject: [PATCH] codetools: ExtractProcHead: extract parameter type colon only if names and types are wanted git-svn-id: trunk@28531 - --- components/codetools/pascalparsertool.pas | 8 ++++++-- components/codetools/pascalreadertool.pas | 10 ++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/components/codetools/pascalparsertool.pas b/components/codetools/pascalparsertool.pas index 93e1b3dc1a..39017afcbc 100644 --- a/components/codetools/pascalparsertool.pas +++ b/components/codetools/pascalparsertool.pas @@ -1387,8 +1387,11 @@ begin if not Extract then ReadNextAtom else - ExtractNextAtom([phpWithoutParamList,phpWithoutParamTypes]*Attr=[], - Attr); + // extract the colon if parameter names and types are requested + ExtractNextAtom( + [phpWithoutParamList,phpWithoutParamTypes,phpWithParameterNames]*Attr + =[phpWithParameterNames], + Attr); if not ReadParamType(ExceptionOnError,Extract,Attr) then exit; if CurPos.Flag=cafEqual then begin // read default value @@ -1557,6 +1560,7 @@ function TPascalParserTool.ReadTilProcedureHeadEnd( procedure Intf.Method = ImplementingMethodName; function CommitUrlCacheEntry; // only Delphi procedure MacProcName(c: char; ...); external; + operator + (dp1: TPoint; dp2: TPoint) dps: TPoint; Delphi mode: Function TPOSControler.Logout; // missing function type diff --git a/components/codetools/pascalreadertool.pas b/components/codetools/pascalreadertool.pas index bfbc428e67..a0fabd0b5d 100644 --- a/components/codetools/pascalreadertool.pas +++ b/components/codetools/pascalreadertool.pas @@ -120,6 +120,7 @@ type function NodeIsDestructor(ProcNode: TCodeTreeNode): boolean; function NodeIsForwardProc(ProcNode: TCodeTreeNode): boolean; function NodeIsOperator(ProcNode: TCodeTreeNode): boolean; + function NodeIsResultIdentifier(Node: TCodeTreeNode): boolean; function NodeIsResultType(Node: TCodeTreeNode): boolean; // classes @@ -1759,6 +1760,15 @@ begin Result:=CompareIdentifiers('operator',@Src[ProcNode.StartPos])=0; end; +function TPascalReaderTool.NodeIsResultIdentifier(Node: TCodeTreeNode + ): boolean; +begin + Result:=(Node<>nil) + and (Node.Desc=ctnVarDefinition) + and (Node.Parent<>nil) + and (Node.Parent.Desc=ctnProcedureHead); +end; + function TPascalReaderTool.NodeIsResultType(Node: TCodeTreeNode): boolean; begin Result:=(Node<>nil)