Browse Source

* fixed more line numering output
* proper error message for generic methods not found
* fix small bug in replaying

git-svn-id: trunk@5121 -

florian 19 years ago
parent
commit
a3a650ee73
2 changed files with 28 additions and 16 deletions
  1. 13 12
      compiler/psub.pas
  2. 15 4
      compiler/scanner.pas

+ 13 - 12
compiler/psub.pas

@@ -1693,18 +1693,19 @@ implementation
          begin
            if hp.deftype=procdef then
              begin
-               if not(
-                      assigned(tprocdef(hp).genericdef) and
-                      (tprocdef(hp).genericdef.deftype=procdef) and
-                      assigned(tprocdef(tprocdef(hp).genericdef).generictokenbuf)
-                     ) then
-                 internalerror(200512111);
-               oldcurrent_filepos:=current_filepos;
-               current_filepos:=tprocdef(tprocdef(hp).genericdef).fileinfo;
-               current_tokenpos:=current_filepos;
-               current_scanner.startreplaytokens(tprocdef(tprocdef(hp).genericdef).generictokenbuf);
-               read_proc_body(nil,tprocdef(hp));
-               current_filepos:=oldcurrent_filepos;
+               if assigned(tprocdef(hp).genericdef) and
+                 (tprocdef(hp).genericdef.deftype=procdef) and
+                 assigned(tprocdef(tprocdef(hp).genericdef).generictokenbuf) then
+                 begin
+                   oldcurrent_filepos:=current_filepos;
+                   current_filepos:=tprocdef(tprocdef(hp).genericdef).fileinfo;
+                   current_tokenpos:=current_filepos;
+                   current_scanner.startreplaytokens(tprocdef(tprocdef(hp).genericdef).generictokenbuf);
+                   read_proc_body(nil,tprocdef(hp));
+                   current_filepos:=oldcurrent_filepos;
+                 end
+               else
+                 MessagePos1(tprocdef(tprocdef(hp).genericdef).fileinfo,sym_e_forward_not_resolved,tprocdef(tprocdef(hp).genericdef).fullprocname(false));
              end;
            hp:=tdef(hp.indexnext);
          end;

+ 15 - 4
compiler/scanner.pas

@@ -1946,7 +1946,9 @@ In case not, the value returned can be arbitrary.
           { load token from the buffer }
           replaytokenbuf.read(token,1);
           if token=_ID then
-            replaytokenbuf.read(idtoken,1);
+            replaytokenbuf.read(idtoken,1)
+          else
+            idtoken:=_NOID;
           case token of
             _CWCHAR,
             _CWSTRING :
@@ -1978,11 +1980,20 @@ In case not, the value returned can be arbitrary.
                   ST_LOADSETTINGS:
                     replaytokenbuf.read(current_settings,sizeof(current_settings));
                   ST_LINE:
-                    replaytokenbuf.read(current_tokenpos.line,sizeof(current_tokenpos.line));
+                    begin
+                      replaytokenbuf.read(current_tokenpos.line,sizeof(current_tokenpos.line));
+                      current_filepos:=current_tokenpos;
+                    end;
                   ST_COLUMN:
-                    replaytokenbuf.read(current_tokenpos.column,sizeof(current_tokenpos.column));
+                    begin
+                      replaytokenbuf.read(current_tokenpos.column,sizeof(current_tokenpos.column));
+                      current_filepos:=current_tokenpos;
+                    end;
                   ST_FILEINDEX:
-                    replaytokenbuf.read(current_tokenpos.fileindex,sizeof(current_tokenpos.fileindex));
+                    begin
+                      replaytokenbuf.read(current_tokenpos.fileindex,sizeof(current_tokenpos.fileindex));
+                      current_filepos:=current_tokenpos;
+                    end;
                   else
                     internalerror(2006103010);
                 end;