Explorar el Código

* save block_type before creating a temporary scanner and restore afterwards,
because creating a new scanner sets the block_type back to bt_general
(while we want to inject something in the current context)

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

Jonas Maebe hace 14 años
padre
commit
f2374ce24d
Se han modificado 1 ficheros con 7 adiciones y 1 borrados
  1. 7 1
      compiler/symcreat.pas

+ 7 - 1
compiler/symcreat.pas

@@ -74,12 +74,14 @@ interface
 implementation
 
   uses
-    cutils,verbose,systems,comphook,
+    cutils,globtype,globals,verbose,systems,comphook,
     symtype,symsym,symtable,defutil,
     pbase,pdecobj,pdecsub,psub,
     defcmp;
 
   procedure replace_scanner(const tempname: string; out sstate: tscannerstate);
+    var
+      old_block_type: tblock_type;
     begin
       { would require saving of idtoken, pattern etc }
       if (token=_ID) then
@@ -88,7 +90,11 @@ implementation
       sstate.old_token:=token;
       sstate.old_c:=c;
       sstate.valid:=true;
+      { creating a new scanner resets the block type, while we want to continue
+        in the current one }
+      old_block_type:=block_type;
       current_scanner:=tscannerfile.Create('_Macro_.'+tempname);
+      block_type:=old_block_type;
     end;