Commit 78f952fc authored by hugues.jerome's avatar hugues.jerome
Browse files

* Correct resolution of component instance in applies to

          clause



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@2105 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent e96a1411
...@@ -1013,7 +1013,7 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -1013,7 +1013,7 @@ package body Ocarina.Analyzer.AADL.Links is
Pointed_Node : Node_Id := No_Node; Pointed_Node : Node_Id := No_Node;
Other_Pointed_Node : Node_Id := No_Node; Other_Pointed_Node : Node_Id := No_Node;
No_Ref_Given : Boolean := False; No_Ref_Given : Boolean := False;
-- Some features may not refere to components (e.g. data ports) -- Some features may not refer to components (e.g. data ports)
begin begin
if AADL_Version = AADL_V2 if AADL_Version = AADL_V2
and then Present (Entity_Ref (Node)) and then Present (Entity_Ref (Node))
...@@ -1034,7 +1034,6 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -1034,7 +1034,6 @@ package body Ocarina.Analyzer.AADL.Links is
declare declare
Component_Ref : constant Node_Id := Entity_Ref (Node); Component_Ref : constant Node_Id := Entity_Ref (Node);
begin begin
if Present (Component_Ref) then if Present (Component_Ref) then
Pointed_Node := Find_Component_Classifier Pointed_Node := Find_Component_Classifier
(Root => Root, (Root => Root,
...@@ -1847,7 +1846,7 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -1847,7 +1846,7 @@ package body Ocarina.Analyzer.AADL.Links is
end if; end if;
end if; end if;
-- link 'applies to' statement -- Link 'applies to' statement
if not Is_Empty (Applies_To_Prop (Node)) then if not Is_Empty (Applies_To_Prop (Node)) then
List_Node := First_Node (Applies_To_Prop (Node)); List_Node := First_Node (Applies_To_Prop (Node));
...@@ -1873,8 +1872,8 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -1873,8 +1872,8 @@ package body Ocarina.Analyzer.AADL.Links is
Corresponding_Container := Pointed_Node; Corresponding_Container := Pointed_Node;
when others => when others =>
-- Entities that cannot have 'applies to' clause in -- These entities cannot have 'applies to'
-- their property associations. -- clause in their property associations.
Corresponding_Container := No_Node; Corresponding_Container := No_Node;
end case; end case;
...@@ -1887,32 +1886,46 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -1887,32 +1886,46 @@ package body Ocarina.Analyzer.AADL.Links is
Identifier (Tmp_Node)); Identifier (Tmp_Node));
Tmp_Node := Identifier (Tmp_Node); Tmp_Node := Identifier (Tmp_Node);
else else
Pointed_Node := Find_Subclause (Corresponding_Container, while Tmp_Node /= No_Node loop
Tmp_Node); Pointed_Node := Find_Subclause
end if; (Corresponding_Container, Tmp_Node);
-- XXX Fix the link for all contained element path
else
Pointed_Node := No_Node;
end if;
if Present (Pointed_Node) then if Present (Pointed_Node) then
Set_Corresponding_Entity (Tmp_Node, Pointed_Node); Set_Corresponding_Entity (Tmp_Node, Pointed_Node);
List_Node := Next_Node (List_Node); Set_Corresponding_Entity
-- XXX Fix the link for all contained element path (First_Node (List_Items (List_Node)),
Pointed_Node);
else else
DAE (Node1 => Node, DAE (Node1 => Node,
Message1 => "applies to something that" Message1 => "points to ",
& " cannot be found"); Node2 => Tmp_Node,
Message2 =>
"that is not a valid subcomponent");
Success := False; Success := False;
exit; exit;
end if; end if;
Tmp_Node := Next_Node (Tmp_Node);
if No (Tmp_Node) then
exit;
end if;
Corresponding_Container :=
Get_Referenced_Entity (Entity_Ref (Pointed_Node));
end loop; end loop;
end if;
if No (Pointed_Node) then else
DAE (Node1 => Node, DAE (Node1 => Node,
Message1 => "applies to something that cannot be found"); Message1 =>
"applies to something that cannot be found");
-- XXX is this the correct error message?
Pointed_Node := No_Node;
end if;
List_Node := Next_Node (List_Node);
end loop;
if No (Pointed_Node) then
Success := False; Success := False;
end if; end if;
end if; end if;
...@@ -1952,9 +1965,9 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -1952,9 +1965,9 @@ package body Ocarina.Analyzer.AADL.Links is
return Success; return Success;
end Link_Property_Association; end Link_Property_Association;
-------------------------------- ---------------------
-- Link_Properties -- -- Link_Properties --
-------------------------------- ---------------------
function Link_Properties function Link_Properties
(Root : Node_Id; (Root : Node_Id;
...@@ -1981,9 +1994,9 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -1981,9 +1994,9 @@ package body Ocarina.Analyzer.AADL.Links is
return Success; return Success;
end Link_Properties; end Link_Properties;
---------------------------------------------------- -----------------------------------------
-- Link_Properties_Of_AADL_Description -- -- Link_Properties_Of_AADL_Description --
---------------------------------------------------- -----------------------------------------
function Link_Properties_Of_AADL_Description function Link_Properties_Of_AADL_Description
(Root : Node_Id) (Root : Node_Id)
...@@ -2024,9 +2037,9 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -2024,9 +2037,9 @@ package body Ocarina.Analyzer.AADL.Links is
return Success; return Success;
end Link_Properties_Of_AADL_Description; end Link_Properties_Of_AADL_Description;
--------------------------------------------- ----------------------------------
-- Link_Properties_Of_Component -- -- Link_Properties_Of_Component --
--------------------------------------------- ----------------------------------
function Link_Properties_Of_Component function Link_Properties_Of_Component
(Root : Node_Id; (Root : Node_Id;
...@@ -2061,9 +2074,9 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -2061,9 +2074,9 @@ package body Ocarina.Analyzer.AADL.Links is
return Success; return Success;
end Link_Properties_Of_Component; end Link_Properties_Of_Component;
------------------------------------------------------------ -------------------------------------------------
-- Link_Properties_Of_Component_Implementation -- -- Link_Properties_Of_Component_Implementation --
------------------------------------------------------------ -------------------------------------------------
function Link_Properties_Of_Component_Implementation function Link_Properties_Of_Component_Implementation
(Root : Node_Id; (Root : Node_Id;
...@@ -2193,9 +2206,9 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -2193,9 +2206,9 @@ package body Ocarina.Analyzer.AADL.Links is
return Success; return Success;
end Link_Properties_Of_Component_Implementation; end Link_Properties_Of_Component_Implementation;
-------------------------------------------------- ---------------------------------------
-- Link_Properties_Of_Component_Type -- -- Link_Properties_Of_Component_Type --
-------------------------------------------------- ---------------------------------------
function Link_Properties_Of_Component_Type function Link_Properties_Of_Component_Type
(Root : Node_Id; (Root : Node_Id;
...@@ -2254,9 +2267,9 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -2254,9 +2267,9 @@ package body Ocarina.Analyzer.AADL.Links is
return Success; return Success;
end Link_Properties_Of_Component_Type; end Link_Properties_Of_Component_Type;
------------------------------------------- --------------------------------
-- Link_Properties_Of_Package -- -- Link_Properties_Of_Package --
------------------------------------------- --------------------------------
function Link_Properties_Of_Package function Link_Properties_Of_Package
(Root : Node_Id; (Root : Node_Id;
...@@ -2304,9 +2317,9 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -2304,9 +2317,9 @@ package body Ocarina.Analyzer.AADL.Links is
return Success; return Success;
end Link_Properties_Of_Package; end Link_Properties_Of_Package;
------------------------------------------------------ -------------------------------------------
-- Link_Properties_Of_Feature_Group_Type -- -- Link_Properties_Of_Feature_Group_Type --
------------------------------------------------------ -------------------------------------------
function Link_Properties_Of_Feature_Group_Type function Link_Properties_Of_Feature_Group_Type
(Root : Node_Id; (Root : Node_Id;
...@@ -2685,7 +2698,6 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -2685,7 +2698,6 @@ package body Ocarina.Analyzer.AADL.Links is
when K_Reference_Term => when K_Reference_Term =>
case Kind (Reference_Term (Node)) is case Kind (Reference_Term (Node)) is
when K_Entity_Reference => when K_Entity_Reference =>
-- AADL_V1 -- AADL_V1
...@@ -2843,7 +2855,7 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -2843,7 +2855,7 @@ package body Ocarina.Analyzer.AADL.Links is
Set_Referenced_Entity (Node, Pointed_Node); Set_Referenced_Entity (Node, Pointed_Node);
-- IMPORTANT: we do not perform any verification -- IMPORTANT: we do not perform any verification
-- reguarding the validity of this reference: a single -- regarding the validity of this reference: a single
-- value property association may refer to a -- value property association may refer to a
-- multi-valued constant. This is checked in the -- multi-valued constant. This is checked in the
-- semantics packages. -- semantics packages.
...@@ -2906,6 +2918,7 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -2906,6 +2918,7 @@ package body Ocarina.Analyzer.AADL.Links is
Second_Term (Node), Second_Term (Node),
Property_Type) Property_Type)
and then Success; and then Success;
when K_Not_Boolean_Term | K_Parenthesis_Boolean_Term => when K_Not_Boolean_Term | K_Parenthesis_Boolean_Term =>
Success := Link_Property_Value Success := Link_Property_Value
(Root, (Root,
......
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