瀏覽代碼

Generate an error if a unit listed as in "contains" is part of a directly or indirectly required package.

pmodules.pas, proc_package:
  * walk all units and check whether it had been loaded from a package, but is also part of the units of the current module; if so then generate an error

git-svn-id: branches/svenbarth/packages@32480 -
svenbarth 9 年之前
父節點
當前提交
dd4cdca7ab
共有 1 個文件被更改,包括 13 次插入0 次删除
  1. 13 0
      compiler/pmodules.pas

+ 13 - 0
compiler/pmodules.pas

@@ -1494,6 +1494,19 @@ type
                  if not assigned(uu) then
                    message2(package_n_implicit_unit_import,hp.realmodulename^,current_module.realmodulename^);
                end;
+             { was this unit listed as a contained unit? If so => error }
+             if (hp<>current_module) and assigned(hp.package) then
+               begin
+                 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 assigned(uu) then
+                   message2(package_e_unit_already_contained_in_package,hp.realmodulename^,hp.package.realpackagename^);
+               end;
              hp:=tmodule(hp.next);
            end;