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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """Module to manage IDL files.""" 6 """Module to manage IDL files."""
7 7
8 import copy 8 import copy
9 import pickle 9 import pickle
10 import logging 10 import logging
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 raise RuntimeError('Interface %s not found' % interface_name) 218 raise RuntimeError('Interface %s not found' % interface_name)
219 self._interfaces_to_delete.append(interface_name) 219 self._interfaces_to_delete.append(interface_name)
220 del self._all_interfaces[interface_name] 220 del self._all_interfaces[interface_name]
221 221
222 def _DeleteInterfaceFile(self, interface_name): 222 def _DeleteInterfaceFile(self, interface_name):
223 """Actual file deletion""" 223 """Actual file deletion"""
224 file_path = self._FilePath(interface_name) 224 file_path = self._FilePath(interface_name)
225 if os.path.exists(file_path): 225 if os.path.exists(file_path):
226 _logger.debug('deleting %s' % file_path) 226 _logger.debug('deleting %s' % file_path)
227 os.remove(file_path) 227 os.remove(file_path)
228
229 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.
230 if test(interface):
231 return interface
232 for parent in interface.parents:
233 parent_name = parent.type.id
234 if not self.HasInterface(parent.type.id):
235 continue
236 parent_interface = self.GetInterface(parent.type.id)
237 parent_interface = self.FindInHierarchy(parent_interface, test)
238 if parent_interface:
239 return parent_interface
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698