Commit 08636a6d authored by jhugues's avatar jhugues
Browse files

* 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 ...@@ -1119,6 +1119,28 @@ package body Ocarina.Analyzer.AADL.Finder is
return Pointed_Node; return Pointed_Node;
end Find_Subcomponent; 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 -- -- Find_Subprogram_Call --
-------------------------- --------------------------
......
...@@ -86,6 +86,12 @@ package Ocarina.Analyzer.AADL.Finder is ...@@ -86,6 +86,12 @@ package Ocarina.Analyzer.AADL.Finder is
return Node_Id; return Node_Id;
-- Same as above, but find a mode -- Same as above, but find a mode
function Find_Prototype
(Component : Node_Id;
Prototype_Identifier : Node_Id)
return Node_Id;
-- XXX
function Find_Subcomponent function Find_Subcomponent
(Component : Node_Id; (Component : Node_Id;
Subcomponent_Identifier : Node_Id; Subcomponent_Identifier : Node_Id;
......
...@@ -86,7 +86,7 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -86,7 +86,7 @@ package body Ocarina.Analyzer.AADL.Links is
Node : Node_Id) Node : Node_Id)
return Boolean; return Boolean;
-- Perform all the designator and identifier links in the -- 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 function Link_Feature_Group_Type_Subclauses
(Root : Node_Id; (Root : Node_Id;
...@@ -403,7 +403,7 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -403,7 +403,7 @@ package body Ocarina.Analyzer.AADL.Links is
-- subprogram spec may be declared at the end of the AADL -- subprogram spec may be declared at the end of the AADL
-- specification. -- specification.
Success := Link_Feature (Root, Other_Pointed_Node) Success := Link_Feature (Root, Other_Pointed_Node, No_Node)
and then Success; and then Success;
Set_Referenced_Entity (Entity_Ref (Node), Other_Pointed_Node); Set_Referenced_Entity (Entity_Ref (Node), Other_Pointed_Node);
...@@ -444,7 +444,7 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -444,7 +444,7 @@ package body Ocarina.Analyzer.AADL.Links is
(Ocarina.Me_AADL.AADL_Tree.Nodes.Refines_Type (Node)); (Ocarina.Me_AADL.AADL_Tree.Nodes.Refines_Type (Node));
while Present (List_Node) loop while Present (List_Node) loop
Success := Link_Feature (Root, List_Node) Success := Link_Feature (Root, List_Node, No_Node)
and then Success; and then Success;
List_Node := Next_Node (List_Node); List_Node := Next_Node (List_Node);
end loop; end loop;
...@@ -681,7 +681,7 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -681,7 +681,7 @@ package body Ocarina.Analyzer.AADL.Links is
List_Node := First_Node (Features (Node)); List_Node := First_Node (Features (Node));
while Present (List_Node) loop while Present (List_Node) loop
Success := Link_Feature (Root, List_Node) Success := Link_Feature (Root, List_Node, Node)
and then Success; and then Success;
List_Node := Next_Node (List_Node); List_Node := Next_Node (List_Node);
end loop; end loop;
...@@ -997,7 +997,8 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -997,7 +997,8 @@ package body Ocarina.Analyzer.AADL.Links is
function Link_Feature function Link_Feature
(Root : Node_Id; (Root : Node_Id;
Node : Node_Id) Node : Node_Id;
Component_Type : Node_Id)
return Boolean return Boolean
is is
use Ocarina.Analyzer.AADL.Semantics; use Ocarina.Analyzer.AADL.Semantics;
...@@ -1041,6 +1042,15 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -1041,6 +1042,15 @@ package body Ocarina.Analyzer.AADL.Links is
(Component_Ref), (Component_Ref),
Component_Identifier => Identifier Component_Identifier => Identifier
(Component_Ref)); (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 if No (Pointed_Node) then
DLTWN (Node, Component_Ref); DLTWN (Node, Component_Ref);
Success := False; Success := False;
...@@ -1064,6 +1074,7 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -1064,6 +1074,7 @@ package body Ocarina.Analyzer.AADL.Links is
K_Component_Implementation) K_Component_Implementation)
and then Component_Category'Val and then Component_Category'Val
(Category (Pointed_Node)) = CC_Data) (Category (Pointed_Node)) = CC_Data)
and then not (Kind (Pointed_Node) = K_Prototype)
then then
DLTWN (Node, Pointed_Node); DLTWN (Node, Pointed_Node);
Success := False; Success := False;
...@@ -1748,8 +1759,7 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -1748,8 +1759,7 @@ package body Ocarina.Analyzer.AADL.Links is
First_Node (Ocarina.Me_AADL.AADL_Tree.Nodes.Features (Node)); First_Node (Ocarina.Me_AADL.AADL_Tree.Nodes.Features (Node));
while Present (List_Node) loop while Present (List_Node) loop
Success := Link_Feature Success := Link_Feature (Root, List_Node, No_Node)
(Root, List_Node)
and then Success; and then Success;
List_Node := Next_Node (List_Node); List_Node := Next_Node (List_Node);
end loop; end loop;
...@@ -2604,6 +2614,7 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -2604,6 +2614,7 @@ package body Ocarina.Analyzer.AADL.Links is
(Classifier_Ref (List_Node)), (Classifier_Ref (List_Node)),
Port_Group_Identifier => Identifier Port_Group_Identifier => Identifier
(Classifier_Ref (List_Node)))); (Classifier_Ref (List_Node))));
when others => when others =>
Set_Referenced_Entity Set_Referenced_Entity
(Classifier_Ref (List_Node), (Classifier_Ref (List_Node),
......
...@@ -53,6 +53,8 @@ package Ocarina.Analyzer.AADL.Links is ...@@ -53,6 +53,8 @@ package Ocarina.Analyzer.AADL.Links is
return Boolean; return Boolean;
-- Perform the link of subclauses (subcomponents, calls...) -- Perform the link of subclauses (subcomponents, calls...)
private
function Link_Component_Or_Feature_Group_Extension function Link_Component_Or_Feature_Group_Extension
(Root : Node_Id; (Root : Node_Id;
Node : Node_Id) Node : Node_Id)
...@@ -133,7 +135,8 @@ package Ocarina.Analyzer.AADL.Links is ...@@ -133,7 +135,8 @@ package Ocarina.Analyzer.AADL.Links is
function Link_Feature function Link_Feature
(Root : Node_Id; (Root : Node_Id;
Node : Node_Id) Node : Node_Id;
Component_Type : Node_Id)
return Boolean; return Boolean;
-- Perform the link between the feature type to the actual data -- Perform the link between the feature type to the actual data
-- component. -- component.
......
...@@ -350,6 +350,19 @@ package body Ocarina.Analyzer.AADL.Names is ...@@ -350,6 +350,19 @@ package body Ocarina.Analyzer.AADL.Names is
Push_Scope (Entity_Scope (Node)); 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 -- Features
if not Is_Empty (Features (Node)) then if not Is_Empty (Features (Node)) then
......
Supports Markdown
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