Commit ec09f261 by Arnaud Charlet

[multiple changes]

2011-09-05  Johannes Kanig  <kanig@adacore.com>

	* lib-xref-alfa.adb (Is_Alfa_Reference): Filter constants from effect
	information.

2011-09-05  Ed Schonberg  <schonberg@adacore.com>

	* par-ch6.adb (P_Subprogram): In Ada2012 mode, if the subprogram
	appears within a package specification and the token after "IS"
	is not a parenthesis, assume that this is an unparenthesized
	expression function, even if the token appears in a line by
	itself.
	* par.adb: Clarify use of Labl field of scope stack in error
	recovery.

From-SVN: r178532
parent 7109f4f5
2011-09-05 Johannes Kanig <kanig@adacore.com>
* lib-xref-alfa.adb (Is_Alfa_Reference): Filter constants from effect
information.
2011-09-05 Ed Schonberg <schonberg@adacore.com>
* par-ch6.adb (P_Subprogram): In Ada2012 mode, if the subprogram
appears within a package specification and the token after "IS"
is not a parenthesis, assume that this is an unparenthesized
expression function, even if the token appears in a line by
itself.
* par.adb: Clarify use of Labl field of scope stack in error
recovery.
2011-09-05 Bob Duff <duff@adacore.com>
* sem_res.adb (Resolve_Intrinsic_Operator): Use unchecked
......
......@@ -616,7 +616,9 @@ package body Alfa is
-- section, as these will be translated as constants in the
-- intermediate language for formal verification.
when E_In_Parameter =>
-- Above comment is incomplete??? what about E_Constant case
when E_In_Parameter | E_Constant =>
return False;
when others =>
......@@ -624,18 +626,13 @@ package body Alfa is
-- Objects of Task type or protected type are not Alfa
-- references.
if Present (Etype (E)) then
case Ekind (Etype (E)) is
when E_Task_Type | E_Protected_Type =>
return False;
when others =>
null;
end case;
if Present (Etype (E))
and then Ekind (Etype (E)) in E_Concurrent_Kind
then
return False;
end if;
return Typ = 'r' or else Typ = 'm';
end case;
end Is_Alfa_Reference;
......
......@@ -675,10 +675,42 @@ package body Ch6 is
else
-- If the identifier is the first token on its line, then
-- let's assume that we have a missing begin and this is
-- intended as a subprogram body.
-- intended as a subprogram body. However, if the context
-- is a function and the unit is a package declaration, a
-- body would be illegal, so try for an unparenthesized
-- expression function.
if Token_Is_At_Start_Of_Line then
return False;
declare
-- The enclosing scope entry is a subprogram spec.
Spec_Node : constant Node_Id :=
Parent (Scope.Table (Scope.Last).Labl);
Lib_Node : Node_Id := Spec_Node;
begin
-- Check whether there is an enclosing scope that
-- is a package declaration.
if Scope.Last > 1 then
Lib_Node :=
Parent (Scope.Table (Scope.Last - 1).Labl);
end if;
if Ada_Version >= Ada_2012
and then
Nkind (Lib_Node) = N_Package_Specification
and then
Nkind (Spec_Node) = N_Function_Specification
then
null;
else
return False;
end if;
end;
-- Otherwise we have to scan ahead. If the identifier is
-- followed by a colon or a comma, it is a declaration
......
......@@ -466,15 +466,22 @@ function Par (Configuration_Pragmas : Boolean) return List_Id is
-- control heuristic error recovery actions.
Labl : Node_Id;
-- This field is used only for the LOOP and BEGIN cases, and is the
-- Node_Id value of the label name. For all cases except child units,
-- this value is an entity whose Chars field contains the name pointer
-- that identifies the label uniquely. For the child unit case the Labl
-- field references an N_Defining_Program_Unit_Name node for the name.
-- For cases other than LOOP or BEGIN, the Label field is set to Error,
-- indicating that it is an error to have a label on the end line.
-- This field is used to provide the name of the construct being parsed
-- and indirectly its kind. For loops and blocks, the field contains the
-- source name or the generated one. For package specifications, bodies,
-- subprogram specifications and bodies the field holds the correponding
-- program unit name. For task declarations and bodies, protected types
-- and bodies, and accept statements the field hold the name of the type
-- or operation. For if-statements, case-statements, and selects, the
-- field is initialized to Error, indicating that it is an error to have
-- a label on the end line.
-- (this is really a misuse of Error since there is no Error ???)
-- Whenever the field is a name, it is attached to the parent node of
-- the construct being parsed. Thus the parent node indicates the kind
-- of construct whose parse tree is being built. This is used in error
-- recovery.
Decl : List_Id;
-- Points to the list of declarations (i.e. the declarative part)
-- associated with this construct. It is set only in the END [name]
......
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