diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2020-02-20 12:10:53 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-06-10 09:34:57 -0400 |
commit | 3ea95664954775a1a85c9ea097877754984807aa (patch) | |
tree | 947786978b4235ed7ff387acb9b2abddbbe6346d | |
parent | 414e7520e608aaef1cac17bfeddd13af893ef81c (diff) | |
download | gcc-3ea95664954775a1a85c9ea097877754984807aa.zip gcc-3ea95664954775a1a85c9ea097877754984807aa.tar.gz gcc-3ea95664954775a1a85c9ea097877754984807aa.tar.bz2 |
[Ada] Simplify detection of static membership choices
2020-06-10 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* sem_ch13.adb (All_Membership_Choices_Static): Assert an AST
property documented in sinfo.ads and simplify an excessive
condition.
-rw-r--r-- | gcc/ada/sem_ch13.adb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index fda3177..61f5e45 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -844,11 +844,16 @@ package body Sem_Ch13 is function All_Membership_Choices_Static (Expr : Node_Id) return Boolean is pragma Assert (Nkind (Expr) in N_Membership_Test); begin - return ((Present (Right_Opnd (Expr)) - and then Is_Static_Choice (Right_Opnd (Expr))) - or else - (Present (Alternatives (Expr)) - and then All_Static_Choices (Alternatives (Expr)))); + pragma Assert + (Present (Right_Opnd (Expr)) + xor + Present (Alternatives (Expr))); + + if Present (Right_Opnd (Expr)) then + return Is_Static_Choice (Right_Opnd (Expr)); + else + return All_Static_Choices (Alternatives (Expr)); + end if; end All_Membership_Choices_Static; ------------------------ |