Browse Source

fpcp.pas, tpcppackage:
+ new method add_required_package() to add a required package while ignoring duplicates

git-svn-id: branches/svenbarth/packages@32510 -

svenbarth 9 years ago
parent
commit
bb07909509
1 changed files with 15 additions and 0 deletions
  1. 15 0
      compiler/fpcp.pas

+ 15 - 0
compiler/fpcp.pas

@@ -57,6 +57,7 @@ interface
       function getmodulestream(module:tmodulebase):tcstream;
       function getmodulestream(module:tmodulebase):tcstream;
       procedure initmoduleinfo(module:tmodulebase);
       procedure initmoduleinfo(module:tmodulebase);
       procedure addunit(module:tmodulebase);
       procedure addunit(module:tmodulebase);
+      procedure add_required_package(pkg:tpackage);
     end;
     end;
 
 
 implementation
 implementation
@@ -551,5 +552,19 @@ implementation
       containedmodules.add(module.modulename^,containedunit);
       containedmodules.add(module.modulename^,containedunit);
     end;
     end;
 
 
+
+  procedure tpcppackage.add_required_package(pkg:tpackage);
+    var
+      p : tpackage;
+    begin
+      p:=tpackage(requiredpackages.find(pkg.packagename^));
+      if not assigned(p) then
+        requiredpackages.Add(pkg.packagename^,pkg)
+      else
+        if p<>pkg then
+          internalerror(2015112302);
+    end;
+
+
 end.
 end.