Browse Source

Check whether a unit has been implicitely imported in a package. A unit is considered as implicitely imported if it is not part of a required package nor part of the units listed in the contains section. This note is useful (Delphi even provides a dialog in that case) as a package with implicitely imported units /might/ become incompatible with other packages (e.g. if another package includes that unit uses that package and includes that unit explicitely; of course that is the same as if both package included it explicitely, but with the hint one knows where to look).

pmodules.pas, proc_package:
  * while walking the loaded units also check whether any of them not contained in a package was part of the contained units which are the same as the current module's used units

git-svn-id: branches/svenbarth/packages@31993 -
svenbarth 10 years ago
parent
commit
84cb8d7b2f
1 changed files with 10 additions and 0 deletions
  1. 10 0
      compiler/pmodules.pas

+ 10 - 0
compiler/pmodules.pas

@@ -1483,6 +1483,16 @@ type
                begin
                  if (hp.flags and uf_package_deny) <> 0 then
                    message1(package_e_unit_deny_package,hp.realmodulename^);
+                 { part of the package's used, aka contained units? }
+                 uu:=tused_unit(current_module.used_units.first);
+                 while assigned(uu) do
+                   begin
+                     if uu.u=hp then
+                       break;
+                     uu:=tused_unit(uu.next);
+                   end;
+                 if not assigned(uu) then
+                   message2(package_n_implicit_unit_import,hp.realmodulename^,current_module.realmodulename^);
                end;
              hp:=tmodule(hp.next);
            end;