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

Unified Diff: tools/dom/scripts/database.py

Issue 19820007: Fixes for Blink roll. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minors fixes Created 7 years, 5 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
Index: tools/dom/scripts/database.py
diff --git a/tools/dom/scripts/database.py b/tools/dom/scripts/database.py
index 69e1963fca707728961c130e5fc1942361c6089c..11f86670cddce97fc0fd38b7dd2e874ac22160f5 100755
--- a/tools/dom/scripts/database.py
+++ b/tools/dom/scripts/database.py
@@ -14,6 +14,7 @@ import shutil
import idlnode
import idlparser
import idlrenderer
+from generator import IsDartCollectionType, IsPureInterface
_logger = logging.getLogger('database')
@@ -245,3 +246,34 @@ class Database(object):
def AddEnum(self, enum):
self._enums[enum.id] = enum
+
+ def TransitiveSecondaryParents(self, interface):
+ """Returns a list of all non-primary parents.
+
+ The list contains the interface objects for interfaces defined in the
+ database, and the name for undefined interfaces.
+ """
+ def walk(parents):
+ for parent in parents:
+ parent_name = parent.type.id
+ if parent_name == 'EventTarget':
+ # Currently EventTarget is implemented as a mixin, not a proper
+ # super interface---ignore its members.
+ continue
+ if IsDartCollectionType(parent_name):
+ result.append(parent_name)
+ continue
+ if self.HasInterface(parent_name):
+ parent_interface = self.GetInterface(parent_name)
+ result.append(parent_interface)
+ walk(parent_interface.parents)
+
+ result = []
+ if interface.parents:
+ parent = interface.parents[0]
+ if IsPureInterface(parent.type.id):
+ walk(interface.parents)
+ else:
+ walk(interface.parents[1:])
+ return result
+

Powered by Google App Engine
This is Rietveld 408576698