procedure Sloc_Range (N : Node_Id; Min, Max : out Source_Ptr) is
- Indx : constant Source_File_Index := Get_Source_File_Index (Sloc (N));
+ Indx : constant Source_File_Index := Get_Source_File_Index (Sloc (N));
function Process (N : Node_Id) return Traverse_Result;
-- Process function for traversing the node tree
-------------
function Process (N : Node_Id) return Traverse_Result is
- Orig : constant Node_Id := Original_Node (N);
+ Loc : constant Source_Ptr := Sloc (Original_Node (N));
begin
-- Skip nodes that may have been added during expansion and
-- that originate in other units, such as code for contracts
-- in subprogram bodies.
- if Get_Source_File_Index (Sloc (Orig)) /= Indx then
+ if Get_Source_File_Index (Loc) /= Indx then
return Skip;
end if;
- if Sloc (Orig) < Min then
- if Sloc (Orig) > No_Location then
- Min := Sloc (Orig);
- end if;
-
- elsif Sloc (Orig) > Max then
- if Sloc (Orig) > No_Location then
- Max := Sloc (Orig);
+ if Loc > No_Location then
+ if Loc < Min then
+ Min := Loc;
+ elsif Loc > Max then
+ Max := Loc;
end if;
end if;
begin
Min := Sloc (N);
- Max := Sloc (N);
+ Max := Min;
Traverse (N);
end Sloc_Range;