aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2021-05-28 15:32:16 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2021-07-09 12:35:26 +0000
commit81956c08f74be83aa61cba6c112b92cdc0198a66 (patch)
tree7e7cfe0b7f4c706b2e21b0fe935f5011fe23530c
parente40f4ab46364c3e16c35c4d96c89187e8cae5a65 (diff)
downloadgcc-81956c08f74be83aa61cba6c112b92cdc0198a66.zip
gcc-81956c08f74be83aa61cba6c112b92cdc0198a66.tar.gz
gcc-81956c08f74be83aa61cba6c112b92cdc0198a66.tar.bz2
[Ada] Reorder preanalysis of static expression functions
gcc/ada/ * sem_ch6.adb (Analyze_Expression_Function): Reorder code.
-rw-r--r--gcc/ada/sem_ch6.adb16
1 files changed, 6 insertions, 10 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 0ecac3f..d543253 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -524,6 +524,12 @@ package body Sem_Ch6 is
Install_Formals (Def_Id);
Preanalyze_Spec_Expression (Expr, Typ);
End_Scope;
+ else
+ Push_Scope (Def_Id);
+ Install_Formals (Def_Id);
+ Preanalyze_Formal_Expression (Expr, Typ);
+ Check_Limited_Return (Orig_N, Expr, Typ);
+ End_Scope;
end if;
-- If this is a wrapper created in an instance for a formal
@@ -561,16 +567,6 @@ package body Sem_Ch6 is
end;
end if;
- -- Preanalyze the expression if not already done above
-
- if not Inside_A_Generic then
- Push_Scope (Def_Id);
- Install_Formals (Def_Id);
- Preanalyze_Formal_Expression (Expr, Typ);
- Check_Limited_Return (Orig_N, Expr, Typ);
- End_Scope;
- end if;
-
-- In the case of an expression function marked with the aspect
-- Static, we need to check the requirement that the function's
-- expression is a potentially static expression. This is done