diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2023-03-31 14:40:10 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-05-29 10:23:18 +0200 |
commit | e73516e5ccd617aa50a5b0111b35aa063e1a6fd5 (patch) | |
tree | a9a07d2893a578ee16a4c8db3018bcf64cd3dbc3 /gcc/ada/contracts.adb | |
parent | edb66b5f4d33363e1e5c0a74fcf2b4734093f508 (diff) | |
download | gcc-e73516e5ccd617aa50a5b0111b35aa063e1a6fd5.zip gcc-e73516e5ccd617aa50a5b0111b35aa063e1a6fd5.tar.gz gcc-e73516e5ccd617aa50a5b0111b35aa063e1a6fd5.tar.bz2 |
ada: Simplify removal of formals from the scope
Calls to Install_Formals are typically enclosed by Push_Scope/End_Scope.
There were just two such calls that instead used Pop_Scope, but most
likely that was by mistake.
Cleanup related to handling of class-wide contracts. Behavior appears to
be unaffected.
gcc/ada/
* contracts.adb (Remove_Formals): Remove.
(Preanalyze_Condition): Replace Pop_Scope with End_Scope.
* sem_ch13.adb (Build_Discrete_Static_Predicate): Replace
Pop_Scope with End_Scope; enclose Install_Formals within
Push_Scope/End_Scope.
Diffstat (limited to 'gcc/ada/contracts.adb')
-rw-r--r-- | gcc/ada/contracts.adb | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb index 9d02887..65f341a 100644 --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -4846,9 +4846,6 @@ package body Contracts is -- Traverse Expr and clear the Controlling_Argument of calls to -- nonabstract functions. - procedure Remove_Formals (Id : Entity_Id); - -- Remove formals from homonym chains and make them not visible - procedure Restore_Original_Selected_Component; -- Traverse Expr searching for dispatching calls to functions whose -- original node was a selected component, and replace them with @@ -4898,21 +4895,6 @@ package body Contracts is Remove_Ctrl_Args (Expr); end Remove_Controlling_Arguments; - -------------------- - -- Remove_Formals -- - -------------------- - - procedure Remove_Formals (Id : Entity_Id) is - F : Entity_Id := First_Formal (Id); - - begin - while Present (F) loop - Set_Is_Immediately_Visible (F, False); - Remove_Homonym (F); - Next_Formal (F); - end loop; - end Remove_Formals; - ----------------------------------------- -- Restore_Original_Selected_Component -- ----------------------------------------- @@ -5032,8 +5014,7 @@ package body Contracts is Preanalyze_Spec_Expression (Expr, Standard_Boolean); Inside_Class_Condition_Preanalysis := False; - Remove_Formals (Subp); - Pop_Scope; + End_Scope; -- If this preanalyzed condition has occurrences of dispatching calls -- using the Object.Operation notation, during preanalysis such calls |