Browse Source

Ensure that all implicitely imported units are indeed part of the package.

pmodules.pas, proc_package:
  * instead of checking the units loaded by the current module we need to check *all* units that are loaded for the package

git-svn-id: branches/svenbarth/packages@32462 -
svenbarth 9 years ago
parent
commit
8d99dd6391
1 changed files with 10 additions and 9 deletions
  1. 10 9
      compiler/pmodules.pas

+ 10 - 9
compiler/pmodules.pas

@@ -1644,15 +1644,16 @@ type
 
 
          if (not current_module.is_unit) then
          if (not current_module.is_unit) then
            begin
            begin
-             { add all contained units to the package }
-             { TODO : handle implicitly imported units }
-             uu:=tused_unit(current_module.used_units.first);
-             while assigned(uu) do
-               begin
-                 if not assigned(uu.u.package) then
-                   pkg.addunit(uu.u);
-                 uu:=tused_unit(uu.next);
-               end;
+             { we add all loaded units that are not part of a package to the
+               package; this includes units in the "contains" section as well
+               as implicitely imported ones }
+             hp:=tmodule(loaded_units.first);
+             while assigned(hp) do
+              begin
+                if (hp<>current_module) and not assigned(hp.package) then
+                  pkg.addunit(hp);
+                hp:=tmodule(hp.next);
+              end;
 
 
              pkg.initmoduleinfo(current_module);
              pkg.initmoduleinfo(current_module);