Browse Source

* always save/restore the current_filepos when injecting code, sometimes it
isn't reset yet before a message is printed after parsing injected source
code

git-svn-id: branches/jvmbackend@18982 -

Jonas Maebe 14 years ago
parent
commit
019a58ab1d
1 changed files with 4 additions and 1 deletions
  1. 4 1
      compiler/symcreat.pas

+ 4 - 1
compiler/symcreat.pas

@@ -35,6 +35,7 @@ interface
   type
   type
     tscannerstate = record
     tscannerstate = record
       old_scanner: tscannerfile;
       old_scanner: tscannerfile;
+      old_filepos: tfileposinfo;
       old_token: ttoken;
       old_token: ttoken;
       old_c: char;
       old_c: char;
       old_orgpattern: string;
       old_orgpattern: string;
@@ -136,6 +137,7 @@ implementation
          (token=_CWSTRING) then
          (token=_CWSTRING) then
         internalerror(2011032201);
         internalerror(2011032201);
       sstate.old_scanner:=current_scanner;
       sstate.old_scanner:=current_scanner;
+      sstate.old_filepos:=current_filepos;
       sstate.old_token:=token;
       sstate.old_token:=token;
       sstate.old_c:=c;
       sstate.old_c:=c;
       sstate.old_orgpattern:=orgpattern;
       sstate.old_orgpattern:=orgpattern;
@@ -158,6 +160,7 @@ implementation
         begin
         begin
           current_scanner.free;
           current_scanner.free;
           current_scanner:=sstate.old_scanner;
           current_scanner:=sstate.old_scanner;
+          current_filepos:=sstate.old_filepos;
           token:=sstate.old_token;
           token:=sstate.old_token;
           current_settings.modeswitches:=sstate.old_modeswitches;
           current_settings.modeswitches:=sstate.old_modeswitches;
           c:=sstate.old_c;
           c:=sstate.old_c;
@@ -220,7 +223,7 @@ implementation
       parse_only:=false;
       parse_only:=false;
       result:=false;
       result:=false;
       { inject the string in the scanner }
       { inject the string in the scanner }
-      str:=str+'end;';
+      str:=str+'const;';
       current_scanner.substitutemacro('meth_impl_macro',@str[1],length(str),current_scanner.line_no,current_scanner.inputfile.ref_index);
       current_scanner.substitutemacro('meth_impl_macro',@str[1],length(str),current_scanner.line_no,current_scanner.inputfile.ref_index);
       current_scanner.readtoken(false);
       current_scanner.readtoken(false);
       { and parse it... }
       { and parse it... }