Commit 20e97fcd authored by hugues.jerome's avatar hugues.jerome
Browse files

* (Find_Instance): solve incorrect traversal when encountering

	  a contained_element_path

git-svn-id: 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 9718e5b9
......@@ -85,6 +85,8 @@ package body Ocarina.Instances.Finder is
List_Node : Node_Id;
Actual_List_Node : Node_Id;
Pointed_Instance : Node_Id;
Use_Contained_Element_Path : Boolean := False;
-- Path may be the path of an entity reference; in this case it
-- is a list of node_container that contain identifiers. Else
......@@ -92,38 +94,55 @@ package body Ocarina.Instances.Finder is
if Path = No_List then
Pointed_Instance := Reference_Instance;
Pointed_Instance := Reference_Instance;
List_Node := ATN.First_Node (Path);
while Present (List_Node) loop
if not Use_Contained_Element_Path then
if ATN.Kind (List_Node) = K_Node_Container then
Actual_List_Node := ATN.Item (List_Node);
elsif ATN.Kind (List_Node) = K_Identifier then
Actual_List_Node := List_Node;
-- XXX check whether AADLv2 always implies
-- Use_Contained_Element_Path to be true.
Actual_List_Node := ATN.First_Node (List_Items (List_Node));
Use_Contained_Element_Path := True;
end if;
end if;
pragma Assert (ATN.Kind (Actual_List_Node) = K_Identifier);
Pointed_Instance := Find_Local_Instance
(Pointed_Instance, Actual_List_Node);
if No (Pointed_Instance) then
elsif Kind (Pointed_Instance) = K_Call_Instance then
Pointed_Instance := Duplicate_Subprogram_Call_Instance
Pointed_Instance := Corresponding_Instance (Pointed_Instance);
elsif Kind (Pointed_Instance) = K_Subcomponent_Instance then
Pointed_Instance := Corresponding_Instance (Pointed_Instance);
end if;
if not Use_Contained_Element_Path then
List_Node := ATN.Next_Node (List_Node);
Actual_List_Node := ATN.Next_Node (Actual_List_Node);
if No (Actual_List_Node) then
end if;
end if;
end loop;
end if;
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