Ind_Comp :=
Make_Indexed_Component (Loc,
- Prefix => Relocate_Node (Array_Node),
+ Prefix => New_Copy_Tree (Array_Node),
Expressions => New_List (New_Occurrence_Of (Iterator, Loc)));
+ -- Propagate the original node to the copy since the analysis of the
+ -- following object renaming declaration relies on the original node.
+
+ Set_Original_Node (Prefix (Ind_Comp), Original_Node (Array_Node));
+
Prepend_To (Stats,
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Id,
Defining_Identifier => Iterator,
Discrete_Subtype_Definition =>
Make_Attribute_Reference (Loc,
- Prefix => Relocate_Node (Array_Node),
+ Prefix => New_Copy_Tree (Array_Node),
Attribute_Name => Name_Range,
Expressions => New_List (
Make_Integer_Literal (Loc, Dim1))),
Defining_Identifier => Iterator,
Discrete_Subtype_Definition =>
Make_Attribute_Reference (Loc,
- Prefix => Relocate_Node (Array_Node),
+ Prefix => New_Copy_Tree (Array_Node),
Attribute_Name => Name_Range,
Expressions => New_List (
Make_Integer_Literal (Loc, Dim1))),
--- /dev/null
+-- { dg-do compile }
+-- { dg-options "-gnatd.F -gnatws" }
+
+package body Iter2
+ with SPARK_Mode
+is
+ function To_String (Name : String) return String
+ is
+ procedure Append (Result : in out String;
+ Data : String)
+ with Inline_Always;
+ procedure Append (Result : in out String;
+ Data : String)
+ is
+ begin
+ for C of Data
+ loop
+ Result (1) := C;
+ end loop;
+ end Append;
+
+ Result : String (1 .. 3);
+ begin
+ Append (Result, "</" & Name & ">");
+ return Result;
+ end To_String;
+
+end Iter2;