| OLD | NEW |
| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 from memory. | 268 from memory. |
| 269 | 269 |
| 270 Args: | 270 Args: |
| 271 dictionary -- the name of the dictionary. | 271 dictionary -- the name of the dictionary. |
| 272 """ | 272 """ |
| 273 dictionary_name = dictionary.id | 273 dictionary_name = dictionary.id |
| 274 if dictionary_name in self._all_dictionaries: | 274 if dictionary_name in self._all_dictionaries: |
| 275 raise RuntimeError('Dictionary %s already exists' % dictionary_name) | 275 raise RuntimeError('Dictionary %s already exists' % dictionary_name) |
| 276 self._all_dictionaries[dictionary_name] = dictionary | 276 self._all_dictionaries[dictionary_name] = dictionary |
| 277 | 277 |
| 278 def GetDictionaries(self): |
| 279 """Returns a list of all loaded dictionaries.""" |
| 280 res = [] |
| 281 for _, dictionary in sorted(self._all_dictionaries.items()): |
| 282 res.append(dictionary) |
| 283 return res |
| 284 |
| 278 def TransitiveSecondaryParents(self, interface, propagate_event_target): | 285 def TransitiveSecondaryParents(self, interface, propagate_event_target): |
| 279 """Returns a list of all non-primary parents. | 286 """Returns a list of all non-primary parents. |
| 280 | 287 |
| 281 The list contains the interface objects for interfaces defined in the | 288 The list contains the interface objects for interfaces defined in the |
| 282 database, and the name for undefined interfaces. | 289 database, and the name for undefined interfaces. |
| 283 """ | 290 """ |
| 284 def walk(parents): | 291 def walk(parents): |
| 285 for parent in parents: | 292 for parent in parents: |
| 286 parent_name = parent.type.id | 293 parent_name = parent.type.id |
| 287 if IsDartCollectionType(parent_name): | 294 if IsDartCollectionType(parent_name): |
| 288 result.append(parent_name) | 295 result.append(parent_name) |
| 289 continue | 296 continue |
| 290 if self.HasInterface(parent_name): | 297 if self.HasInterface(parent_name): |
| 291 parent_interface = self.GetInterface(parent_name) | 298 parent_interface = self.GetInterface(parent_name) |
| 292 result.append(parent_interface) | 299 result.append(parent_interface) |
| 293 walk(parent_interface.parents) | 300 walk(parent_interface.parents) |
| 294 | 301 |
| 295 result = [] | 302 result = [] |
| 296 if interface.parents: | 303 if interface.parents: |
| 297 parent = interface.parents[0] | 304 parent = interface.parents[0] |
| 298 if (IsPureInterface(parent.type.id) or | 305 if (IsPureInterface(parent.type.id) or |
| 299 (propagate_event_target and parent.type.id == 'EventTarget')): | 306 (propagate_event_target and parent.type.id == 'EventTarget')): |
| 300 walk(interface.parents) | 307 walk(interface.parents) |
| 301 else: | 308 else: |
| 302 walk(interface.parents[1:]) | 309 walk(interface.parents[1:]) |
| 303 return result | 310 return result |
| 304 | 311 |
| OLD | NEW |