Commit 08636a6d authored by jhugues's avatar jhugues

* Complete resolution of prototypes elements used as features



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@4585 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 83473f64
......@@ -1119,6 +1119,28 @@ package body Ocarina.Analyzer.AADL.Finder is
return Pointed_Node;
end Find_Subcomponent;
--------------------
-- Find_Prototype --
--------------------
function Find_Prototype
(Component : Node_Id;
Prototype_Identifier : Node_Id)
return Node_Id
is
pragma Assert (Kind (Component) = K_Component_Type);
pragma Assert (Kind (Prototype_Identifier) = K_Identifier);
Pointed_Node : Node_Id;
begin
Pointed_Node := Find_Subclause_Declaration_Classifier
(Component,
Prototype_Identifier,
(1 => K_Prototype));
return Pointed_Node;
end Find_Prototype;
--------------------------
-- Find_Subprogram_Call --
--------------------------
......
......@@ -86,6 +86,12 @@ package Ocarina.Analyzer.AADL.Finder is
return Node_Id;
-- Same as above, but find a mode
function Find_Prototype
(Component : Node_Id;
Prototype_Identifier : Node_Id)
return Node_Id;
-- XXX
function Find_Subcomponent
(Component : Node_Id;
Subcomponent_Identifier : Node_Id;
......
......@@ -86,7 +86,7 @@ package body Ocarina.Analyzer.AADL.Links is
Node : Node_Id)
return Boolean;
-- Perform all the designator and identifier links in the
-- subclauses (featues...) of a component type.
-- subclauses (features...) of a component type.
function Link_Feature_Group_Type_Subclauses
(Root : Node_Id;
......@@ -403,7 +403,7 @@ package body Ocarina.Analyzer.AADL.Links is
-- subprogram spec may be declared at the end of the AADL
-- specification.
Success := Link_Feature (Root, Other_Pointed_Node)
Success := Link_Feature (Root, Other_Pointed_Node, No_Node)
and then Success;
Set_Referenced_Entity (Entity_Ref (Node), Other_Pointed_Node);
......@@ -444,7 +444,7 @@ package body Ocarina.Analyzer.AADL.Links is
(Ocarina.Me_AADL.AADL_Tree.Nodes.Refines_Type (Node));
while Present (List_Node) loop
Success := Link_Feature (Root, List_Node)
Success := Link_Feature (Root, List_Node, No_Node)
and then Success;
List_Node := Next_Node (List_Node);
end loop;
......@@ -681,7 +681,7 @@ package body Ocarina.Analyzer.AADL.Links is
List_Node := First_Node (Features (Node));
while Present (List_Node) loop
Success := Link_Feature (Root, List_Node)
Success := Link_Feature (Root, List_Node, Node)
and then Success;
List_Node := Next_Node (List_Node);
end loop;
......@@ -997,7 +997,8 @@ package body Ocarina.Analyzer.AADL.Links is
function Link_Feature
(Root : Node_Id;
Node : Node_Id)
Node : Node_Id;
Component_Type : Node_Id)
return Boolean
is
use Ocarina.Analyzer.AADL.Semantics;
......@@ -1041,6 +1042,15 @@ package body Ocarina.Analyzer.AADL.Links is
(Component_Ref),
Component_Identifier => Identifier
(Component_Ref));
if No (Pointed_Node)
and then Present (Component_Type)
then
Pointed_Node := Find_Prototype
(Component_Type,
Identifier (Component_Ref));
end if;
if No (Pointed_Node) then
DLTWN (Node, Component_Ref);
Success := False;
......@@ -1064,6 +1074,7 @@ package body Ocarina.Analyzer.AADL.Links is
K_Component_Implementation)
and then Component_Category'Val
(Category (Pointed_Node)) = CC_Data)
and then not (Kind (Pointed_Node) = K_Prototype)
then
DLTWN (Node, Pointed_Node);
Success := False;
......@@ -1748,8 +1759,7 @@ package body Ocarina.Analyzer.AADL.Links is
First_Node (Ocarina.Me_AADL.AADL_Tree.Nodes.Features (Node));
while Present (List_Node) loop
Success := Link_Feature
(Root, List_Node)
Success := Link_Feature (Root, List_Node, No_Node)
and then Success;
List_Node := Next_Node (List_Node);
end loop;
......@@ -2604,6 +2614,7 @@ package body Ocarina.Analyzer.AADL.Links is
(Classifier_Ref (List_Node)),
Port_Group_Identifier => Identifier
(Classifier_Ref (List_Node))));
when others =>
Set_Referenced_Entity
(Classifier_Ref (List_Node),
......
......@@ -53,6 +53,8 @@ package Ocarina.Analyzer.AADL.Links is
return Boolean;
-- Perform the link of subclauses (subcomponents, calls...)
private
function Link_Component_Or_Feature_Group_Extension
(Root : Node_Id;
Node : Node_Id)
......@@ -133,7 +135,8 @@ package Ocarina.Analyzer.AADL.Links is
function Link_Feature
(Root : Node_Id;
Node : Node_Id)
Node : Node_Id;
Component_Type : Node_Id)
return Boolean;
-- Perform the link between the feature type to the actual data
-- component.
......
......@@ -350,6 +350,19 @@ package body Ocarina.Analyzer.AADL.Names is
Push_Scope (Entity_Scope (Node));
-- Prototypes
if not Is_Empty (Prototypes (Node)) then
List_Node := First_Node (Prototypes (Node));
while Present (List_Node) loop
Success := Enter_Name_In_Scope (Identifier (List_Node))
-- and then Check_Property_Association_Names (List_Node)
and then Success;
List_Node := Next_Node (List_Node);
end loop;
end if;
-- Features
if not Is_Empty (Features (Node)) then
......
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