Procházet zdrojové kódy

* Allow System.Variants (Delphi-compatible name) to be found when inserting variants unit

Michaël Van Canneyt před 2 roky
rodič
revize
9e228ff355
1 změnil soubory, kde provedl 9 přidání a 2 odebrání
  1. 9 2
      compiler/pmodules.pas

+ 9 - 2
compiler/pmodules.pas

@@ -211,23 +211,30 @@ implementation
     procedure maybeloadvariantsunit;
       var
         hp : tmodule;
+        addsystemnamespace : Boolean;
       begin
         { Do we need the variants unit? Skip this
           for VarUtils unit for bootstrapping }
         if not(mf_uses_variants in current_module.moduleflags) or
-           (current_module.modulename^='VARUTILS') then
+           (current_module.modulename^='VARUTILS') or
+           (current_module.modulename^='SYSTEM.VARUTILS') then
           exit;
         { Variants unit already loaded? }
         hp:=tmodule(loaded_units.first);
         while assigned(hp) do
           begin
-            if hp.modulename^='VARIANTS' then
+            if (hp.modulename^='VARIANTS') or (hp.modulename^='SYSTEM.VARIANTS') then
               exit;
             hp:=tmodule(hp.next);
           end;
         { Variants unit is not loaded yet, load it now }
         Message(parser_w_implicit_uses_of_variants_unit);
+        addsystemnamespace:=namespacelist.Find('System')=Nil;
+        if addsystemnamespace then
+          namespacelist.concat('System');
         AddUnit('variants');
+        if addsystemnamespace then
+          namespacelist.Remove('System');
       end;