Browse Source

* fix lineinfo for with blocks

peter 20 năm trước cách đây
mục cha
commit
ced6bf20cd
8 tập tin đã thay đổi với 65 bổ sung35 xóa
  1. 5 2
      compiler/ncal.pas
  2. 5 2
      compiler/ncnv.pas
  3. 5 2
      compiler/nflw.pas
  4. 5 2
      compiler/nmem.pas
  5. 4 16
      compiler/node.pas
  6. 20 2
      compiler/nutils.pas
  7. 15 6
      compiler/pexpr.pas
  8. 6 3
      compiler/pstatmnt.pas

+ 5 - 2
compiler/ncal.pas

@@ -369,7 +369,7 @@ type
          inherited create(callparan,expr,next);
          if not assigned(expr) then
            internalerror(200305091);
-         expr.set_file_line(self);
+         expr.fileinfo:=fileinfo;
          callparaflags:=[];
       end;
 
@@ -2449,7 +2449,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.271  2004-12-15 21:08:15  peter
+  Revision 1.272  2004-12-26 16:22:01  peter
+    * fix lineinfo for with blocks
+
+  Revision 1.271  2004/12/15 21:08:15  peter
     * disable inlining across units when the inline procedure references
       a variable or procedure in the static symtable
 

+ 5 - 2
compiler/ncnv.pas

@@ -506,7 +506,7 @@ implementation
          totype:=t;
          if t.def=nil then
           internalerror(200103281);
-         set_file_line(node);
+         fileinfo:=node.fileinfo;
       end;
 
 
@@ -2497,7 +2497,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.167  2004-12-07 16:11:52  peter
+  Revision 1.168  2004-12-26 16:22:01  peter
+    * fix lineinfo for with blocks
+
+  Revision 1.167  2004/12/07 16:11:52  peter
     * set vo_explicit_paraloc flag
 
   Revision 1.166  2004/12/05 12:28:11  peter

+ 5 - 2
compiler/nflw.pas

@@ -260,7 +260,7 @@ implementation
          inherited create(tt,l,r);
          t1:=_t1;
          t2:=_t2;
-         set_file_line(l);
+         fileinfo:=l.fileinfo;
       end;
 
     destructor tloopnode.destroy;
@@ -1424,7 +1424,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.102  2004-11-08 22:09:59  peter
+  Revision 1.103  2004-12-26 16:22:01  peter
+    * fix lineinfo for with blocks
+
+  Revision 1.102  2004/11/08 22:09:59  peter
     * tvarsym splitted
 
   Revision 1.101  2004/10/15 09:14:17  mazen

+ 5 - 2
compiler/nmem.pas

@@ -808,7 +808,7 @@ implementation
          withrefnode:=r;
          withsymtable:=symtable;
          tablecount:=count;
-         set_file_line(l);
+         fileinfo:=l.fileinfo;
       end;
 
 
@@ -931,7 +931,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.92  2004-12-05 12:28:11  peter
+  Revision 1.93  2004-12-26 16:22:01  peter
+    * fix lineinfo for with blocks
+
+  Revision 1.92  2004/12/05 12:28:11  peter
     * procvar handling for tp procvar mode fixed
     * proc to procvar moved from addrnode to typeconvnode
     * inlininginfo is now allocated only for inline routines that

+ 4 - 16
compiler/node.pas

@@ -337,8 +337,6 @@ interface
           procedure printnodetree(var t:text);virtual;
           procedure concattolist(l : tlinkedlist);virtual;
           function ischild(p : tnode) : boolean;virtual;
-          procedure set_file_line(from : tnode);
-          procedure set_tree_filepos(const filepos : tfileposinfo);
        end;
 
        tnodeclass = class of tnode;
@@ -828,19 +826,6 @@ implementation
       end;
 
 
-    procedure tnode.set_file_line(from : tnode);
-      begin
-         if assigned(from) then
-           fileinfo:=from.fileinfo;
-      end;
-
-
-    procedure tnode.set_tree_filepos(const filepos : tfileposinfo);
-      begin
-         fileinfo:=filepos;
-      end;
-
-
 {****************************************************************************
                                  TUNARYNODE
  ****************************************************************************}
@@ -1139,7 +1124,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.92  2004-12-05 12:28:11  peter
+  Revision 1.93  2004-12-26 16:22:01  peter
+    * fix lineinfo for with blocks
+
+  Revision 1.92  2004/12/05 12:28:11  peter
     * procvar handling for tp procvar mode fixed
     * proc to procvar moved from addrnode to typeconvnode
     * inlininginfo is now allocated only for inline routines that

+ 20 - 2
compiler/nutils.pas

@@ -27,6 +27,7 @@ unit nutils;
 interface
 
   uses
+    globals,
     symsym,node;
 
   const
@@ -66,11 +67,13 @@ interface
     function finalize_data_node(p:tnode):tnode;
 
     function node_complexity(p: tnode): cardinal;
+    procedure node_tree_set_filepos(var n:tnode;const filepos:tfileposinfo);
+
 
 implementation
 
     uses
-      globtype,globals,verbose,
+      globtype,verbose,
       symconst,symbase,symtype,symdef,symtable,
       defutil,defcmp,
       nbas,ncon,ncnv,nld,nflw,nset,ncal,nadd,nmem,
@@ -547,11 +550,26 @@ implementation
       end;
 
 
+    function setnodefilepos(var n: tnode; arg: pointer): foreachnoderesult;
+      begin
+        result:=fen_true;
+        n.fileinfo:=pfileposinfo(arg)^;
+      end;
+
+
+    procedure node_tree_set_filepos(var n:tnode;const filepos:tfileposinfo);
+      begin
+        foreachnodestatic(n,@setnodefilepos,@filepos);
+      end;
+
 end.
 
 {
   $Log$
-  Revision 1.27  2004-12-15 16:00:16  peter
+  Revision 1.28  2004-12-26 16:22:01  peter
+    * fix lineinfo for with blocks
+
+  Revision 1.27  2004/12/15 16:00:16  peter
     * external is again allowed in implementation
 
   Revision 1.26  2004/12/15 15:27:03  jonas

+ 15 - 6
compiler/pexpr.pas

@@ -1236,9 +1236,15 @@ implementation
 
                     case srsymtable.symtabletype of
                       objectsymtable :
-                        p1:=csubscriptnode.create(srsym,load_self_node);
+                        begin
+                          p1:=csubscriptnode.create(srsym,load_self_node);
+                          node_tree_set_filepos(p1,aktfilepos);
+                        end;
                       withsymtable :
-                        p1:=csubscriptnode.create(srsym,tnode(twithsymtable(srsymtable).withrefnode).getcopy);
+                        begin
+                          p1:=csubscriptnode.create(srsym,tnode(twithsymtable(srsymtable).withrefnode).getcopy);
+                          node_tree_set_filepos(p1,aktfilepos);
+                        end;
                       else
                         p1:=cloadnode.create(srsym,srsymtable);
                     end;
@@ -1840,7 +1846,7 @@ implementation
           if (p1<>oldp1) then
            begin
              if assigned(p1) then
-              p1.set_tree_filepos(filepos);
+               p1.fileinfo:=filepos;
              oldp1:=p1;
              filepos:=akttokenpos;
            end;
@@ -2369,7 +2375,7 @@ implementation
                _UNEQUAL :
                  p1:=caddnode.create(unequaln,p1,p2);
              end;
-             p1.set_tree_filepos(filepos);
+             p1.fileinfo:=filepos;
            end
           else
            break;
@@ -2460,7 +2466,7 @@ implementation
           do_resulttypepass(p1);
          afterassignment:=oldafterassignment;
          if p1<>oldp1 then
-           p1.set_tree_filepos(filepos);
+           p1.fileinfo:=filepos;
          expr:=p1;
       end;
 
@@ -2511,7 +2517,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.176  2004-12-06 19:23:05  peter
+  Revision 1.177  2004-12-26 16:22:01  peter
+    * fix lineinfo for with blocks
+
+  Revision 1.176  2004/12/06 19:23:05  peter
   implicit load of variants unit
 
   Revision 1.175  2004/12/05 12:28:11  peter

+ 6 - 3
compiler/pstatmnt.pas

@@ -1025,7 +1025,7 @@ implementation
            end;
          end;
          if assigned(code) then
-          code.set_tree_filepos(filepos);
+           code.fileinfo:=filepos;
          statement:=code;
       end;
 
@@ -1075,7 +1075,7 @@ implementation
            consume(_END);
 
          last:=cblocknode.create(first);
-         last.set_tree_filepos(filepos);
+         last.fileinfo:=filepos;
          statement_block:=last;
       end;
 
@@ -1147,7 +1147,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.148  2004-12-07 16:11:52  peter
+  Revision 1.149  2004-12-26 16:22:01  peter
+    * fix lineinfo for with blocks
+
+  Revision 1.148  2004/12/07 16:11:52  peter
     * set vo_explicit_paraloc flag
 
   Revision 1.147  2004/12/05 12:28:11  peter