aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/contracts.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2017-04-25 11:25:55 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2017-04-25 11:25:55 +0200
commitbfda9ccde6ae7aad1d259e6ebc29fc8f0af3f154 (patch)
tree620d0169e185f5c58d7e2fb05ea77b9573cb7c52 /gcc/ada/contracts.adb
parentded462b0dea5615ac36e1256caffa5f2c7f5f1b8 (diff)
downloadgcc-bfda9ccde6ae7aad1d259e6ebc29fc8f0af3f154.zip
gcc-bfda9ccde6ae7aad1d259e6ebc29fc8f0af3f154.tar.gz
gcc-bfda9ccde6ae7aad1d259e6ebc29fc8f0af3f154.tar.bz2
Code clean ups.
From-SVN: r247158
Diffstat (limited to 'gcc/ada/contracts.adb')
-rw-r--r--gcc/ada/contracts.adb29
1 files changed, 25 insertions, 4 deletions
diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb
index d467c94..eb6443b 100644
--- a/gcc/ada/contracts.adb
+++ b/gcc/ada/contracts.adb
@@ -2025,12 +2025,33 @@ package body Contracts is
return False;
-- Determine whether the subprogram is declared in the visible
- -- declarations of the package containing the type.
+ -- declarations of the package containing the type, or in the
+ -- visible declaration of a child unit of that package.
else
- return List_Containing (Subp_Decl) =
- Visible_Declarations
- (Specification (Unit_Declaration_Node (Scope (Typ))));
+ declare
+ Decls : constant List_Id :=
+ List_Containing (Subp_Decl);
+ Subp_Scope : constant Entity_Id :=
+ Scope (Defining_Entity (Subp_Decl));
+ Typ_Scope : constant Entity_Id := Scope (Typ);
+
+ begin
+ return
+ Decls = Visible_Declarations
+ (Specification (Unit_Declaration_Node (Typ_Scope)))
+
+ or else
+ (Ekind (Subp_Scope) = E_Package
+ and then Typ_Scope /= Subp_Scope
+ and then Is_Child_Unit (Subp_Scope)
+ and then
+ Is_Ancestor_Package (Typ_Scope, Subp_Scope)
+ and then
+ Decls = Visible_Declarations
+ (Specification
+ (Unit_Declaration_Node (Subp_Scope))));
+ end;
end if;
end Has_Public_Visibility_Of_Subprogram;