aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/contracts.ads
diff options
context:
space:
mode:
authorRonan Desplanques <desplanques@adacore.com>2022-10-24 11:50:06 +0200
committerMarc Poulhiès <poulhies@adacore.com>2022-11-08 09:35:02 +0100
commit45656a992eb18bfefe2e6e20d3b425afe945af28 (patch)
treea72c8da1b7fce47af8249b860cd94deebff9711f /gcc/ada/contracts.ads
parent48e2e5b4c2f56b9e3497d57d0974c66604e087a6 (diff)
downloadgcc-45656a992eb18bfefe2e6e20d3b425afe945af28.zip
gcc-45656a992eb18bfefe2e6e20d3b425afe945af28.tar.gz
gcc-45656a992eb18bfefe2e6e20d3b425afe945af28.tar.bz2
ada: Adjust classwide contract expression preanalysis
Before this patch, a classwide contract expression was preanalyzed only when its primitive operation's type was frozen. It caused name resolution to be off in the cases where the freezing took place after the end of the declaration list the primitive operation was declared in. This patch makes it so that if the compiler gets to the end of the declaration list before the type is frozen, it preanalyzes the classwide contract expression, so that the names are resolved in the right context. gcc/ada/ * contracts.adb (Preanalyze_Class_Conditions): New procedure. (Preanalyze_Condition): Moved out from Merge_Class_Conditions in order to be spec-visible. * contracts.ads (Preanalyze_Class_Conditions): New procedure. * sem_prag.adb (Analyze_Pre_Post_Condition_In_Decl_Part): Call Preanalyze_Class_Conditions when necessary.
Diffstat (limited to 'gcc/ada/contracts.ads')
-rw-r--r--gcc/ada/contracts.ads4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/ada/contracts.ads b/gcc/ada/contracts.ads
index bde32ff..ae6355e 100644
--- a/gcc/ada/contracts.ads
+++ b/gcc/ada/contracts.ads
@@ -276,6 +276,10 @@ package Contracts is
-- which are invoked from the caller side; they are also used to build
-- the dispatch-table wrapper (DTW), if required.
+ procedure Preanalyze_Class_Conditions (Spec_Id : Entity_Id);
+ -- Preanalyze class-wide pre-/postconditions of the given subprogram
+ -- specification.
+
procedure Process_Class_Conditions_At_Freeze_Point (Typ : Entity_Id);
-- Merge, preanalyze, and check class-wide pre/postconditions of Typ
-- primitives.