summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-05-22 18:34:25 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-07-03 16:08:55 +0200
commit49754e94e47914e3754c8b1ac4744ad93372f6e8 (patch)
tree3c47080b48093b5abd689ffb7b23a903044104b3
parent6e6279e486b4e2ce02b21495a9f7d7d97342e5bf (diff)
qmi-codegen: when referring to common types, add a copy of the source type
-rw-r--r--build-aux/qmi-codegen/Container.py8
-rw-r--r--build-aux/qmi-codegen/Field.py5
2 files changed, 9 insertions, 4 deletions
diff --git a/build-aux/qmi-codegen/Container.py b/build-aux/qmi-codegen/Container.py
index 556a755..b232b39 100644
--- a/build-aux/qmi-codegen/Container.py
+++ b/build-aux/qmi-codegen/Container.py
@@ -56,9 +56,13 @@ class Container:
for common in common_objects_dictionary:
if common['type'] == 'TLV' and \
common['common-ref'] == field_dictionary['common-ref']:
- # Replace the reference with the actual common dictionary
+ # Replace the reference with a copy of the common dictionary
+ # If the source reference has prerequisites, add them to the copy
+ copy = dict(common)
+ if 'prerequisites' in field_dictionary:
+ copy['prerequisites'] = field_dictionary['prerequisites']
dictionary.remove(field_dictionary)
- dictionary.append(common)
+ dictionary.append(copy)
break
else:
raise RuntimeError('Common type \'%s\' not found' % field_dictionary['name'])
diff --git a/build-aux/qmi-codegen/Field.py b/build-aux/qmi-codegen/Field.py
index 9db0bdf..7bbb94d 100644
--- a/build-aux/qmi-codegen/Field.py
+++ b/build-aux/qmi-codegen/Field.py
@@ -52,9 +52,10 @@ class Field:
for common in common_objects_dictionary:
if common['type'] == 'prerequisite' and \
common['common-ref'] == prerequisite_dictionary['common-ref']:
- # Replace the reference with the actual common dictionary
+ # Replace the reference with a copy of the common dictionary
+ copy = dict(common)
self.prerequisites.remove(prerequisite_dictionary)
- self.prerequisites.append(common)
+ self.prerequisites.append(copy)
break
else:
raise RuntimeError('Common type \'%s\' not found' % prerequisite_dictionary['name'])