Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Unified Diff: Source/bindings/scripts/idl_definitions.py

Issue 205873003: Refactor interface dependency resolution (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/bindings/scripts/idl_reader.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/idl_definitions.py
diff --git a/Source/bindings/scripts/idl_definitions.py b/Source/bindings/scripts/idl_definitions.py
index eb9fee185fe6316c609076e32a318c55a9ab0760..b11a038572b6666e0b94d3d7c55db2455c5acbc7 100644
--- a/Source/bindings/scripts/idl_definitions.py
+++ b/Source/bindings/scripts/idl_definitions.py
@@ -148,6 +148,22 @@ class IdlDefinitions(object):
for interface in self.interfaces.itervalues():
interface.resolve_typedefs(typedefs)
+ def update(self, other):
+ """Update with additional IdlDefinitions."""
+ for interface_name, new_interface in other.interfaces.iteritems():
+ if not new_interface.is_partial:
+ # Add as new interface
+ self.interfaces[interface_name] = new_interface
+ continue
+
+ # Merge partial to existing interface
+ try:
+ self.interfaces[interface_name].merge(new_interface)
+ except KeyError:
+ raise Exception('Tried to merge partial interface for {0}, '
+ 'but no existing interface by that name'
+ .format(interface_name))
+
################################################################################
# Callback Functions
@@ -241,6 +257,12 @@ class IdlInterface(object):
for operation in self.operations:
operation.resolve_typedefs(typedefs)
+ def merge(self, other):
+ """Merge in another interface's members (e.g., partial interface)"""
+ self.attributes.extend(other.attributes)
+ self.constants.extend(other.constants)
+ self.operations.extend(other.operations)
+
class IdlException(IdlInterface):
# Properly exceptions and interfaces are distinct, and thus should inherit a
« no previous file with comments | « no previous file | Source/bindings/scripts/idl_reader.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698