Browse Source

* Allow RTTI directive also before uses clauses

Ryan Joseph 2 years ago
parent
commit
d74d41c5d2
1 changed files with 13 additions and 6 deletions
  1. 13 6
      compiler/pmodules.pas

+ 13 - 6
compiler/pmodules.pas

@@ -2013,7 +2013,8 @@ type
          resources_used : boolean;
          resources_used : boolean;
          program_uses_checkpointer : boolean;
          program_uses_checkpointer : boolean;
          program_name : ansistring;
          program_name : ansistring;
-         consume_semicolon_after_uses : boolean;
+         consume_semicolon_after_uses,
+         consume_semicolon_after_loaded : boolean;
          ps : tprogramparasym;
          ps : tprogramparasym;
          paramnum : longint;
          paramnum : longint;
          textsym : ttypesym;
          textsym : ttypesym;
@@ -2030,6 +2031,8 @@ type
          init_procinfo:=nil;
          init_procinfo:=nil;
          finalize_procinfo:=nil;
          finalize_procinfo:=nil;
          resources_used:=false;
          resources_used:=false;
+         consume_semicolon_after_loaded:=false;
+
          { make the compiler happy and avoid an uninitialized variable warning on Setlength(sc,length(sc)+1); }
          { make the compiler happy and avoid an uninitialized variable warning on Setlength(sc,length(sc)+1); }
          sc:=nil;
          sc:=nil;
 
 
@@ -2092,7 +2095,7 @@ type
                 read, all following directives are parsed as well }
                 read, all following directives are parsed as well }
               setupglobalswitches;
               setupglobalswitches;
 
 
-              consume(_SEMICOLON);
+              consume_semicolon_after_loaded:=true;
 
 
 {$ifdef DEBUG_NODE_XML}
 {$ifdef DEBUG_NODE_XML}
               XMLInitializeNodeFile('library', program_name);
               XMLInitializeNodeFile('library', program_name);
@@ -2142,7 +2145,7 @@ type
                 read, all following directives are parsed as well }
                 read, all following directives are parsed as well }
               setupglobalswitches;
               setupglobalswitches;
 
 
-              consume(_SEMICOLON);
+              consume_semicolon_after_loaded:=true;
 
 
 {$ifdef DEBUG_NODE_XML}
 {$ifdef DEBUG_NODE_XML}
               XMLInitializeNodeFile('program', program_name);
               XMLInitializeNodeFile('program', program_name);
@@ -2165,9 +2168,6 @@ type
            package or not }
            package or not }
          load_packages;
          load_packages;
 
 
-         { global switches are read, so further changes aren't allowed }
-         current_module.in_global:=false;
-
          { set implementation flag }
          { set implementation flag }
          current_module.in_interface:=false;
          current_module.in_interface:=false;
          current_module.interface_compiled:=true;
          current_module.interface_compiled:=true;
@@ -2179,6 +2179,13 @@ type
          { load system unit }
          { load system unit }
          loadsystemunit;
          loadsystemunit;
 
 
+         { consume the semicolon now that the system unit is loaded }
+         if consume_semicolon_after_loaded then
+           consume(_SEMICOLON);
+
+         { global switches are read, so further changes aren't allowed }
+         current_module.in_global:=false;
+  
          { system unit is loaded, now insert feature defines }
          { system unit is loaded, now insert feature defines }
          for feature:=low(tfeature) to high(tfeature) do
          for feature:=low(tfeature) to high(tfeature) do
            if feature in features then
            if feature in features then