end if;
end Change_Node;
- ----------------
- -- Copy_Slots --
- ----------------
+ ------------------------
+ -- Copy_Dynamic_Slots --
+ ------------------------
procedure Copy_Dynamic_Slots
(From, To : Node_Offset; Num_Slots : Slot_Count)
Destination_Slots := Source_Slots;
end Copy_Dynamic_Slots;
+ ----------------
+ -- Copy_Slots --
+ ----------------
+
procedure Copy_Slots (Source, Destination : Node_Id) is
pragma Debug (Validate_Node (Source));
pragma Assert (Source /= Destination);
Node_Offsets.Table (Node_Offsets.First .. Node_Offsets.Last);
begin
+ -- Empty_Or_Error use as described in types.ads
+ if Destination <= Empty_Or_Error or No (Source) then
+ pragma Assert (Serious_Errors_Detected > 0);
+ return;
+ end if;
+
Copy_Dynamic_Slots
(Off_F (Source), Off_F (Destination), S_Size);
All_Node_Offsets (Destination).Slots := All_Node_Offsets (Source).Slots;
end if;
end if;
+ if Subtype_Mark (Def) <= Empty_Or_Error then
+ pragma Assert (Serious_Errors_Detected > 0);
+ -- avoid passing bad argument to Entity
+ return;
+ end if;
+
-- If the parent type has a known size, so does the formal, which makes
-- legal representation clauses that involve the formal.
--------------------------------
procedure Analyze_Number_Declaration (N : Node_Id) is
- E : constant Node_Id := Expression (N);
+ E : Node_Id := Expression (N);
Id : constant Entity_Id := Defining_Identifier (N);
Index : Interp_Index;
It : Interp;
Set_Is_Pure (Id, Is_Pure (Current_Scope));
- -- Process expression, replacing error by integer zero, to avoid
- -- cascaded errors or aborts further along in the processing
-
-- Replace Error by integer zero, which seems least likely to cause
-- cascaded errors.
if E = Error then
- Rewrite (E, Make_Integer_Literal (Sloc (E), Uint_0));
+ pragma Assert (Serious_Errors_Detected > 0);
+ E := Make_Integer_Literal (Sloc (N), Uint_0);
+ Set_Expression (N, E);
Set_Error_Posted (E);
end if;
-- Otherwise we have a subtype mark without a constraint
elsif Error_Posted (S) then
- Rewrite (S, New_Occurrence_Of (Any_Id, Sloc (S)));
+ -- Don't rewrite if S is Empty or Error
+ if S > Empty_Or_Error then
+ Rewrite (S, New_Occurrence_Of (Any_Id, Sloc (S)));
+ end if;
return Any_Type;
else
Defining_Identifier => Subt,
Subtype_Indication =>
Make_Subtype_From_Expr (Nam, Typ)));
- Rewrite (Subtype_Mark (N), New_Occurrence_Of (Subt, Loc));
+
+ declare
+ New_Subtype_Mark : constant Node_Id :=
+ New_Occurrence_Of (Subt, Loc);
+ begin
+ if Present (Subtype_Mark (N)) then
+ Rewrite (Subtype_Mark (N), New_Subtype_Mark);
+ else
+ -- An Ada2022 renaming with no subtype mark
+ Set_Subtype_Mark (N, New_Subtype_Mark);
+ end if;
+ end;
+
Set_Etype (Nam, Subt);
-- Suppress discriminant checks on this subtype if the original