Am 03.11.2017 um 15:31 schrieb Michael Van Canneyt:
> In this case, you can probably simply use
> TPasTreeContainer.FinishScope
> to record the end of the method.

Great, this is easy. I have created (and attached) a patch to add a
SourceEndLinenummer for all elements.
Maybe it is useful for others or even for the trunk.

Thanks for the help.
Michael
Index: packages/fcl-passrc/src/pastree.pp
===================================================================
--- packages/fcl-passrc/src/pastree.pp	(Revision 37557)
+++ packages/fcl-passrc/src/pastree.pp	(Arbeitskopie)
@@ -136,6 +136,7 @@
   public
     SourceFilename: string;
     SourceLinenumber: Integer;
+    SourceEndLinenumber: Integer;
     Visibility: TPasMemberVisibility;
   public
     constructor Create(const AName: string; AParent: TPasElement); virtual;
Index: packages/fcl-passrc/src/pparser.pp
===================================================================
--- packages/fcl-passrc/src/pparser.pp	(Revision 37557)
+++ packages/fcl-passrc/src/pparser.pp	(Arbeitskopie)
@@ -447,7 +447,7 @@
 function ParseSource(AEngine: TPasTreeContainer;
                      const FPCCommandLine, OSTarget, CPUTarget: String;
                      Options : TParseSourceOptions): TPasModule;
-                     
+
 Function IsHintToken(T : String; Out AHint : TPasMemberHint) : boolean;
 Function IsProcModifier(S : String; Out PM : TProcedureModifier) : Boolean;
 Function IsCallingConvention(S : String; out CC : TCallingConvention) : Boolean;
@@ -755,7 +755,7 @@
   El: TPasElement);
 begin
   if ScopeType=stModule then ;
-  if El=nil then ;
+  if El=nil then else El.SourceEndLinenumber := CurrentParser.CurSourcePos.Row;
 end;
 
 function TPasTreeContainer.FindModule(const AName: String): TPasModule;
@@ -2116,7 +2116,7 @@
 
   Result:=Last;
   func:=Last;
-  
+
   if Last.Kind<>pekSet then NextToken;
   if not (Last.Kind in [pekNumber,pekString,pekSet,pekIdent,pekSelf,pekNil]) then
     exit;
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to