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

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

Issue 10703194: Extract interfaces and members renaming logic to a new HtmlRenamer class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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: lib/dom/scripts/database.py
diff --git a/lib/dom/scripts/database.py b/lib/dom/scripts/database.py
index 4c9ef0947e6c94581031c649d1f91ad0d4a79e96..f51e027fa9509842e380b44e44e91959ddf226d4 100755
--- a/lib/dom/scripts/database.py
+++ b/lib/dom/scripts/database.py
@@ -225,3 +225,15 @@ class Database(object):
if os.path.exists(file_path):
_logger.debug('deleting %s' % file_path)
os.remove(file_path)
+
+ def FindInHierarchy(self, interface, test):
Anton Muhin 2012/07/16 10:27:04 I'd rather implement it as Python's generator, som
podivilov 2012/07/16 12:08:36 Done.
+ if test(interface):
+ return interface
+ for parent in interface.parents:
+ parent_name = parent.type.id
+ if not self.HasInterface(parent.type.id):
+ continue
+ parent_interface = self.GetInterface(parent.type.id)
+ parent_interface = self.FindInHierarchy(parent_interface, test)
+ if parent_interface:
+ return parent_interface

Powered by Google App Engine
This is Rietveld 408576698