Commit 1eeeaac7 authored by yoogx's avatar yoogx

* Allow instanciation of incomplete models

        For ticket #41
parent 88527aa6
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. --
-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -72,18 +72,18 @@ package body Ocarina.Instances.Components.Subcomponents is
New_Instance : Node_Id := No_Node;
New_Subinstance : Node_Id;
begin
New_Instance :=
New_Node (K_Subcomponent_Instance, ATN.Loc (Subcomponent));
AIN.Set_Identifier
(New_Instance,
Duplicate_Identifier (ATN.Identifier (Subcomponent)));
AIN.Set_Corresponding_Declaration (New_Instance, Subcomponent);
Set_Destinations (New_Instance, New_List (K_List_Id, No_Location));
if Present (Entity_Ref (Subcomponent))
and then Present
(ATE.Get_Referenced_Entity (Entity_Ref (Subcomponent)))
then
New_Instance :=
New_Node (K_Subcomponent_Instance, ATN.Loc (Subcomponent));
AIN.Set_Identifier
(New_Instance,
Duplicate_Identifier (ATN.Identifier (Subcomponent)));
AIN.Set_Corresponding_Declaration (New_Instance, Subcomponent);
Set_Destinations (New_Instance, New_List (K_List_Id, No_Location));
-- Verify whether the component has been instantiateed or not
New_Subinstance :=
......@@ -103,7 +103,6 @@ package body Ocarina.Instances.Components.Subcomponents is
end if;
else
Display_No_Entity_Ref (Subcomponent);
Display_Instantiation_Error (Subcomponent);
end if;
return New_Instance;
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. --
-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -249,9 +249,11 @@ package body Ocarina.Instances.Components is
-- subcomponent with the current AADL component
-- implementation.
Annotate
(ATE.Get_Referenced_Entity (Entity_Ref (List_Node)),
Component);
if Present (Entity_Ref (List_Node)) then
Annotate
(ATE.Get_Referenced_Entity (Entity_Ref (List_Node)),
Component);
end if;
-- Set the component instance and the
-- subcomponent instance.
......@@ -265,14 +267,15 @@ package body Ocarina.Instances.Components is
-- We apply the properties to the component
-- corresponding to the subcomponent.
Success :=
Apply_Properties
(Instance_Root,
Corresponding_Instance (Instance_Node),
ATN.Properties (List_Node),
Override_Mode => True)
and then Success;
if Present (Entity_Ref (List_Node)) then
Success :=
Apply_Properties
(Instance_Root,
Corresponding_Instance (Instance_Node),
ATN.Properties (List_Node),
Override_Mode => True)
and then Success;
end if;
else
Display_Instantiation_Error (List_Node);
Success := False;
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. --
-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -54,7 +54,7 @@ package body Ocarina.Instances.Messages is
pragma Assert (Present (Node));
Error_Loc (1) := Loc (Node);
Error_Name (1) := Get_Name_Of_Entity (Node);
DE ("%is not associated with any entity");
DW ("%is not associated with any entity");
end Display_No_Entity_Ref;
----------------------------------------
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. --
-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -683,9 +683,11 @@ package body Ocarina.Instances.Processor.Properties is
List_Node := AIN.First_Node (AIN.Subcomponents (Component));
while Present (List_Node) loop
Resolve_Properties_Of_Component_Instance
(Root => Root,
Component => Corresponding_Instance (List_Node));
if Present (Corresponding_Instance (List_Node)) then
Resolve_Properties_Of_Component_Instance
(Root => Root,
Component => Corresponding_Instance (List_Node));
end if;
List_Node := AIN.Next_Node (List_Node);
end loop;
end if;
......
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