declare
Expr_Typ : constant Entity_Id := Etype (Expr);
Loc : constant Source_Ptr := Sloc (N);
- New_Expr : Node_Id;
- Temp_Id : Entity_Id;
+ Temp_Id : constant Entity_Id := Make_Temporary (Loc, 'T');
begin
- Temp_Id := Make_Temporary (Loc, 'T');
Insert_Action (N,
Make_Object_Declaration (Loc,
Defining_Identifier => Temp_Id,
Object_Definition => New_Occurrence_Of (Expr_Typ, Loc),
Expression => Relocate_Node (Expr)));
- New_Expr := New_Occurrence_Of (Temp_Id, Loc);
- Set_Etype (New_Expr, Expr_Typ);
-
- Set_Expression (N, New_Expr);
+ Set_Expression (N, New_Occurrence_Of (Temp_Id, Loc));
end;
end if;
begin
if Is_Anonymous_Access_Type (Typ) then
-- No indirection in this case; just evaluate the temp.
- Result := New_Occurrence_Of (Temp, Loc);
- Set_Etype (Result, Etype (Temp));
+ return New_Occurrence_Of (Temp, Loc);
else
Result := Make_Explicit_Dereference (Loc,
Set_Etype (Result, Typ);
end if;
- end if;
- return Result;
+ return Result;
+ end if;
end Indirect_Temp_Value;
+ --------------------------------------
+ -- Is_Access_Type_For_Indirect_Temp --
+ --------------------------------------
+
function Is_Access_Type_For_Indirect_Temp
(T : Entity_Id) return Boolean is
begin