Index: Source/bindings/scripts/interface_dependency_resolver.py |
diff --git a/Source/bindings/scripts/interface_dependency_resolver.py b/Source/bindings/scripts/interface_dependency_resolver.py |
index c1f220fb59b1fc9db6e96b4fb7d74ecd9ea901b7..0db1ca18328fd4551dcad32a81f5a54c1055dca0 100644 |
--- a/Source/bindings/scripts/interface_dependency_resolver.py |
+++ b/Source/bindings/scripts/interface_dependency_resolver.py |
@@ -44,11 +44,16 @@ from utilities import idl_filename_to_component, is_valid_component_dependency |
# Note that this moves the extended attribute from the interface to the member, |
# which changes the semantics and yields different code than the same extended |
# attribute on the main interface. |
-DEPENDENCY_EXTENDED_ATTRIBUTES = set([ |
- 'Conditional', |
- 'PerContextEnabled', |
- 'RuntimeEnabled', |
-]) |
+# |
+# Paired with the extended attribute name is its value type; needed to be able |
+# to correctly merge interface-level occurrences with ones that may |
+# be present on the method/attribute/constant. |
+DEPENDENCY_EXTENDED_ATTRIBUTES = { |
+ 'Conditional': 'string', |
+ 'PerContextEnabled': 'string', |
+ 'RuntimeEnabled': 'string', |
+ 'TypeChecking': 'list', |
+} |
class InterfaceDependencyResolver(object): |
@@ -243,7 +248,7 @@ def transfer_extended_attributes(dependency_interface, dependency_interface_base |
merged_extended_attributes = dict( |
(key, value) |
for key, value in dependency_interface.extended_attributes.iteritems() |
- if key in DEPENDENCY_EXTENDED_ATTRIBUTES) |
+ if key in DEPENDENCY_EXTENDED_ATTRIBUTES.keys()) |
# A partial interface's members are implemented as static member functions |
# in a separate C++ class. This class name is stored in |
@@ -274,9 +279,26 @@ def transfer_extended_attributes(dependency_interface, dependency_interface_base |
dependency_interface.extended_attributes.get( |
'ImplementedAs', dependency_interface_basename)) |
+ def update_attributes(attributes, extras): |
+ def to_list(x): |
+ if type(x) is list: |
+ return x |
+ else: |
+ return [x] |
+ |
+ for key, value in extras.items(): |
+ if key in attributes: |
+ # Interface-level extended attributes do not take precedence |
+ # over same attribute at the method/attribute/const-level. |
+ # If the attribute value is a list, the two are combined. |
+ if DEPENDENCY_EXTENDED_ATTRIBUTES[key] == 'list': |
+ attributes[key] = to_list(attributes[key]) + to_list(value) |
+ else: |
+ attributes[key] = value |
+ |
for attribute in dependency_interface.attributes: |
- attribute.extended_attributes.update(merged_extended_attributes) |
+ update_attributes(attribute.extended_attributes, merged_extended_attributes) |
for constant in dependency_interface.constants: |
- constant.extended_attributes.update(merged_extended_attributes) |
+ update_attributes(constant.extended_attributes, merged_extended_attributes) |
for operation in dependency_interface.operations: |
- operation.extended_attributes.update(merged_extended_attributes) |
+ update_attributes(operation.extended_attributes, merged_extended_attributes) |