Commit d7a3e18c by Arnaud Charlet

[multiple changes]

2013-07-08  Robert Dewar  <dewar@adacore.com>

	* gnat_rm.texi: Add documentation for Img returning a function.
	* par-prag.adb: Minor reformatting.
	* restrict.adb: Minor reformatting and code reorganization.

2013-07-08  Ed Schonberg  <schonberg@adacore.com>

	* sem_res.adb: add guard to ASIS transform.

From-SVN: r200769
parent 046f1eee
2013-07-08 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Add documentation for Img returning a function.
* par-prag.adb: Minor reformatting.
* restrict.adb: Minor reformatting and code reorganization.
2013-07-08 Ed Schonberg <schonberg@adacore.com>
* sem_res.adb: add guard to ASIS transform.
2013-07-08 Ed Schonberg <schonberg@adacore.com> 2013-07-08 Ed Schonberg <schonberg@adacore.com>
* exp_ch9.adb (Expand_N_Asynchronous_Select): If the trigger * exp_ch9.adb (Expand_N_Asynchronous_Select): If the trigger
......
...@@ -8057,8 +8057,8 @@ indicates whether or not the corresponding actual type has discriminants. ...@@ -8057,8 +8057,8 @@ indicates whether or not the corresponding actual type has discriminants.
@unnumberedsec Attribute Img @unnumberedsec Attribute Img
@findex Img @findex Img
@noindent @noindent
The @code{Img} attribute differs from @code{Image} in that it may be The @code{Img} attribute differs from @code{Image} in that it is applied
applied to objects as well as types, in which case it gives the directly to an object, and yields the same result as
@code{Image} for the subtype of the object. This is convenient for @code{Image} for the subtype of the object. This is convenient for
debugging: debugging:
...@@ -8076,6 +8076,12 @@ Put_Line ("X = " & @var{T}'Image (X)); ...@@ -8076,6 +8076,12 @@ Put_Line ("X = " & @var{T}'Image (X));
@noindent @noindent
where @var{T} is the (sub)type of the object @code{X}. where @var{T} is the (sub)type of the object @code{X}.
Note that technically, in analogy to @code{Image},
@code{X'Img} returns a parameterless function
that returns the appropriate string when called. This means that
@code{X'Img} can be renamed as a function-returning-string, or used
in an instantiation as a function parameter.
@node Attribute Integer_Value @node Attribute Integer_Value
@unnumberedsec Attribute Integer_Value @unnumberedsec Attribute Integer_Value
@findex Integer_Value @findex Integer_Value
......
...@@ -232,9 +232,7 @@ function Prag (Pragma_Node : Node_Id; Semi : Source_Ptr) return Node_Id is ...@@ -232,9 +232,7 @@ function Prag (Pragma_Node : Node_Id; Semi : Source_Ptr) return Node_Id is
Id := Chars (Arg); Id := Chars (Arg);
Expr := Expression (Arg); Expr := Expression (Arg);
if Id = No_Name if Id = No_Name and then Nkind (Expr) = N_Identifier then
and then Nkind (Expr) = N_Identifier
then
case Chars (Expr) is case Chars (Expr) is
when Name_No_Obsolescent_Features => when Name_No_Obsolescent_Features =>
Set_Restriction (No_Obsolescent_Features, Pragma_Node); Set_Restriction (No_Obsolescent_Features, Pragma_Node);
......
...@@ -1171,20 +1171,16 @@ package body Restrict is ...@@ -1171,20 +1171,16 @@ package body Restrict is
function Same_Unit (U1, U2 : Node_Id) return Boolean is function Same_Unit (U1, U2 : Node_Id) return Boolean is
begin begin
if Nkind (U1) = N_Identifier then if Nkind (U1) = N_Identifier and then Nkind (U2) = N_Identifier then
return Nkind (U2) = N_Identifier and then Chars (U1) = Chars (U2); return Chars (U1) = Chars (U2);
elsif Nkind (U2) = N_Identifier then elsif Nkind_In (U1, N_Selected_Component, N_Expanded_Name)
return False;
elsif (Nkind (U1) = N_Selected_Component
or else Nkind (U1) = N_Expanded_Name)
and then and then
(Nkind (U2) = N_Selected_Component Nkind_In (U2, N_Selected_Component, N_Expanded_Name)
or else Nkind (U2) = N_Expanded_Name)
then then
return Same_Unit (Prefix (U1), Prefix (U2)) return Same_Unit (Prefix (U1), Prefix (U2))
and then Same_Unit (Selector_Name (U1), Selector_Name (U2)); and then
Same_Unit (Selector_Name (U1), Selector_Name (U2));
else else
return False; return False;
end if; end if;
......
...@@ -1578,9 +1578,10 @@ package body Sem_Res is ...@@ -1578,9 +1578,10 @@ package body Sem_Res is
end if; end if;
-- If in ASIS_Mode, propagate operand types to original actuals of -- If in ASIS_Mode, propagate operand types to original actuals of
-- function call, which would otherwise not be fully resolved. -- function call, which would otherwise not be fully resolved. If
-- the call has already been constant-folded, nothing to do.
if ASIS_Mode then if ASIS_Mode and then Nkind (N) in N_Op then
if Is_Binary then if Is_Binary then
Set_Parameter_Associations Set_Parameter_Associations
(Original_Node (N), (Original_Node (N),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment