浏览代码

* Issue file change before line and column change in token writes to allow for better display in ppudump utility

git-svn-id: trunk@42601 -
pierre 6 年之前
父节点
当前提交
70b2904c48
共有 1 个文件被更改,包括 10 次插入8 次删除
  1. 10 8
      compiler/scanner.pas

+ 10 - 8
compiler/scanner.pas

@@ -3229,6 +3229,15 @@ type
           end;
           end;
 
 
         { file pos changes? }
         { file pos changes? }
+        if current_tokenpos.fileindex<>last_filepos.fileindex then
+          begin
+            s:=ST_FILEINDEX;
+            writetoken(t);
+            recordtokenbuf.write(s,1);
+            tokenwriteword(current_tokenpos.fileindex);
+            last_filepos.fileindex:=current_tokenpos.fileindex;
+            last_filepos.line:=0;
+          end;
         if current_tokenpos.line<>last_filepos.line then
         if current_tokenpos.line<>last_filepos.line then
           begin
           begin
             s:=ST_LINE;
             s:=ST_LINE;
@@ -3236,6 +3245,7 @@ type
             recordtokenbuf.write(s,1);
             recordtokenbuf.write(s,1);
             tokenwritelongint(current_tokenpos.line);
             tokenwritelongint(current_tokenpos.line);
             last_filepos.line:=current_tokenpos.line;
             last_filepos.line:=current_tokenpos.line;
+            last_filepos.column:=0;
           end;
           end;
         if current_tokenpos.column<>last_filepos.column then
         if current_tokenpos.column<>last_filepos.column then
           begin
           begin
@@ -3254,14 +3264,6 @@ type
               end;
               end;
             last_filepos.column:=current_tokenpos.column;
             last_filepos.column:=current_tokenpos.column;
           end;
           end;
-        if current_tokenpos.fileindex<>last_filepos.fileindex then
-          begin
-            s:=ST_FILEINDEX;
-            writetoken(t);
-            recordtokenbuf.write(s,1);
-            tokenwriteword(current_tokenpos.fileindex);
-            last_filepos.fileindex:=current_tokenpos.fileindex;
-          end;
 
 
         writetoken(token);
         writetoken(token);
         if token<>_GENERICSPECIALTOKEN then
         if token<>_GENERICSPECIALTOKEN then