[Ada] Minor reuse Is_Protected_Component

gcc/ada/

	* lib-xref.adb (Generate_Reference): Fix reference to
	Analyze_Assignment.
	* sem_ch5.adb (Diagnose_Non_Variable_Lhs): Reuse existing
	utility function.
This commit is contained in:
Piotr Trojanek 2020-11-14 23:26:05 +01:00 committed by Pierre-Marie de Rodat
parent c1a69c9871
commit 3480505630
2 changed files with 2 additions and 4 deletions

View File

@ -819,7 +819,7 @@ package body Lib.Xref is
end if; end if;
-- For the left hand of an assignment case, we do nothing here. -- For the left hand of an assignment case, we do nothing here.
-- The processing for Analyze_Assignment_Statement will set the -- The processing for Analyze_Assignment will set the
-- Referenced_As_LHS flag. -- Referenced_As_LHS flag.
else else

View File

@ -192,9 +192,7 @@ package body Sem_Ch5 is
-- directly. -- directly.
elsif (Is_Prival (Ent) and then Within_Function) elsif (Is_Prival (Ent) and then Within_Function)
or else or else Is_Protected_Component (Ent)
(Ekind (Ent) = E_Component
and then Is_Protected_Type (Scope (Ent)))
then then
Error_Msg_N Error_Msg_N
("protected function cannot modify protected object", N); ("protected function cannot modify protected object", N);