Commit a02b795e authored by yoogx's avatar yoogx
Browse files

* Solve resolution circuitry in case a component

          implementation implements a component type that is a rename
          of a component type defined in another package.

          Fix for issue #7
parent 2149538a
......@@ -813,7 +813,7 @@ package body Ocarina.Analyzer.AADL.Finder is
(Root,
Package_Identifier,
Component_Identifier,
(K_Component_Type, K_Component_Implementation));
(K_Component_Type, K_Component_Implementation, K_Alias_Declaration));
end Find_Component_Classifier;
---------------------
......
......@@ -570,16 +570,24 @@ package body Ocarina.Analyzer.AADL.Links is
-- According to the AADL syntax, the component type must be in
-- the same namespace as the implementations.
if Present (Pointed_Node)
and then Kind (Pointed_Node) = K_Alias_Declaration
then
Pointed_Node := Renamed_Entity (Pointed_Node);
end if;
if No (Pointed_Node) then
DAE (Node1 => Node,
Message1 => " implements a component type that does not exist");
Success := False;
elsif Kind (Pointed_Node) /= K_Component_Type then
DAE (Node1 => Node,
Message1 => " implements ",
Node2 => Pointed_Node,
Message2 => ", which is not a component type");
Success := False;
elsif Category (Pointed_Node) /= Category (Node) then
DAE (Node1 => Node,
Message1 => " implements ",
......
......@@ -156,6 +156,7 @@ package body Ocarina.Analyzer.AADL.Names is
Alias := Full_Identifier (Reference (List_Node));
elsif Present (Package_Name (List_Node)) then
-- Alias references a package
Alias := Build_Package_Identifier
(Package_Name (List_Node));
......@@ -200,9 +201,21 @@ package body Ocarina.Analyzer.AADL.Names is
(Corresponding_Entity (Alias)));
end if;
if Present (Ocarina.ME_AADL.AADL_Tree.Nodes.Identifier
(List_Node))
then
Success := Enter_Name_In_Scope
(Ocarina.ME_AADL.AADL_Tree.Nodes.Identifier
(List_Node));
end if;
if No (In_Node) then
Success := False;
Display_Analyzer_Error (Alias, "is not visible");
else
Set_Renamed_Entity (List_Node, In_Node);
end if;
end if;
end;
......
......@@ -482,6 +482,12 @@ package body Ocarina.Analyzer.AADL.Naming_Rules is
List_Node_3
:= Next_Node (List_Node_3);
end loop;
else
if Name (Identifier (List_Node_2))
= Name_Of_Identifier
then
First_Node := List_Node_2;
end if;
end if;
end if;
List_Node_2 := Next_Node (List_Node_2);
......@@ -496,6 +502,7 @@ package body Ocarina.Analyzer.AADL.Naming_Rules is
when others =>
null;
end case;
end Recursive_Node_In_Scope;
......
......@@ -320,9 +320,9 @@ package body Ocarina.Analyzer.AADL.Semantics is
if Applies_To_Prop (Property) = No_List then
Entity_Of_Property := Container;
else
Pointed_Node := First_Node (List_Items
(First_Node
(Applies_To_Prop (Property))));
Pointed_Node := First_Node
(List_Items (First_Node (Applies_To_Prop (Property))));
if Kind (Pointed_Node) = K_Array_Selection then
Entity_Of_Property := Corresponding_Entity
(Identifier (Pointed_Node));
......
......@@ -339,6 +339,10 @@ package body Ocarina.Builder.AADL.Namespaces is
Set_Parent (Node, Namespace);
Set_Identifier (Node, Identifier);
if Present (Identifier) then
Set_Corresponding_Entity (Identifier, Node);
end if;
Set_Package_Name (Node, Package_Name);
Set_Reference (Node, Classifier_Ref);
Set_Entity_Category (Node,
......
......@@ -242,8 +242,11 @@ module Ocarina::ME_AADL::AADL_Tree::Nodes {
octet Category; // component category
octet Entity_Category; // entities category
Node_Id Package_Name; // package name
Node_Id Reference;
Node_Id Package_Name; // name of the package (import)
Node_Id Reference; // entity (renames)
Node_Id Renamed_Entity; // in case of renames, referenced entity
Node_Id Parent;
};
......
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