Skip to content

Commit

Permalink
* Correction for boolean property values
Browse files Browse the repository at this point in the history
  • Loading branch information
yoogx committed Aug 23, 2021
1 parent f462f5e commit 7e7f58a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
14 changes: 12 additions & 2 deletions src/backends/aadl_xml/ocarina-backends-aadl_xml-main.adb
Expand Up @@ -44,6 +44,7 @@ with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils;
with Ocarina.Backends.AADL_XML.Mapping;
with Ocarina.Backends.Utils;
with Ocarina.ME_AADL.AADL_Tree.Entities.Properties;

package body Ocarina.Backends.AADL_XML.Main is

Expand All @@ -53,6 +54,7 @@ package body Ocarina.Backends.AADL_XML.Main is
use Ocarina.Backends.XML_Tree.Nutils;
use Ocarina.Backends.AADL_XML.Mapping;
use Ocarina.Backends.Utils;
use Ocarina.ME_AADL.AADL_Tree.Entities.Properties;

package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package ATE renames Ocarina.ME_AADL.AADL_Tree.Entities;
Expand Down Expand Up @@ -595,8 +597,16 @@ package body Ocarina.Backends.AADL_XML.Main is
and then ATN.Kind (AADL_Property_Value) = ATN.K_Literal
then
-- This property value denotes a literal term

Value_Node := Make_XML_Node ("string");
declare
PV_Type : constant Property_Type :=
Get_Type_Of_Property_Value (AADL_Property_Value, True);
begin
if PV_Type = PT_Boolean then
Value_Node := Make_XML_Node ("boolean");
elsif PV_Type = PT_String then
Value_Node := Make_XML_Node ("string");
end if;
end;

Append_Node_To_List
(Make_Assignement
Expand Down
4 changes: 2 additions & 2 deletions tests/github/issue_287/test_property_terms.aadl.out
Expand Up @@ -60,7 +60,7 @@
</property>
<property name="Test_Properties::a_boolean_property">
<property_value>
<string value="true"/>
<boolean value="true"/>
</property_value>
</property>
<property name="Test_Properties::a_string_property">
Expand Down Expand Up @@ -111,4 +111,4 @@
</properties>
</component>
</components>
</aadl_xml>
</aadl_xml>

1 comment on commit 7e7f58a

@yoogx
Copy link
Contributor Author

@yoogx yoogx commented on 7e7f58a Aug 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For issue #300

Please sign in to comment.