| 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 |
| 11 import os | 11 import os |
| 12 import os.path | 12 import os.path |
| 13 import shutil | 13 import shutil |
| 14 import idlnode | 14 import idlnode |
| 15 import idlparser | |
| 16 import idlrenderer | 15 import idlrenderer |
| 17 from generator import IsDartCollectionType, IsPureInterface | 16 from generator import IsDartCollectionType, IsPureInterface |
| 18 | 17 |
| 19 _logger = logging.getLogger('database') | 18 _logger = logging.getLogger('database') |
| 20 | 19 |
| 21 | 20 |
| 22 class Database(object): | 21 class Database(object): |
| 23 """The Database class manages a collection of IDL files stored | 22 """The Database class manages a collection of IDL files stored |
| 24 inside a directory. | 23 inside a directory. |
| 25 | 24 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 37 root_dir -- a directory. If directory does not exist, it will | 36 root_dir -- a directory. If directory does not exist, it will |
| 38 be created. | 37 be created. |
| 39 """ | 38 """ |
| 40 self._root_dir = root_dir | 39 self._root_dir = root_dir |
| 41 if not os.path.exists(root_dir): | 40 if not os.path.exists(root_dir): |
| 42 _logger.debug('creating root directory %s' % root_dir) | 41 _logger.debug('creating root directory %s' % root_dir) |
| 43 os.makedirs(root_dir) | 42 os.makedirs(root_dir) |
| 44 self._all_interfaces = {} | 43 self._all_interfaces = {} |
| 45 self._interfaces_to_delete = [] | 44 self._interfaces_to_delete = [] |
| 46 self._enums = {} | 45 self._enums = {} |
| 47 self._idlparser = idlparser.IDLParser(idlparser.FREMONTCUT_SYNTAX) | |
| 48 | 46 |
| 49 def Clone(self): | 47 def Clone(self): |
| 50 new_database = Database(self._root_dir) | 48 new_database = Database(self._root_dir) |
| 51 new_database._all_interfaces = copy.deepcopy(self._all_interfaces) | 49 new_database._all_interfaces = copy.deepcopy(self._all_interfaces) |
| 52 new_database._interfaces_to_delete = copy.deepcopy( | 50 new_database._interfaces_to_delete = copy.deepcopy( |
| 53 self._interfaces_to_delete) | 51 self._interfaces_to_delete) |
| 54 new_database._enums = copy.deepcopy(self._enums) | 52 new_database._enums = copy.deepcopy(self._enums) |
| 55 return new_database | 53 return new_database |
| 56 | 54 |
| 57 def Delete(self): | 55 def Delete(self): |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 result = [] | 265 result = [] |
| 268 if interface.parents: | 266 if interface.parents: |
| 269 parent = interface.parents[0] | 267 parent = interface.parents[0] |
| 270 if (IsPureInterface(parent.type.id) or | 268 if (IsPureInterface(parent.type.id) or |
| 271 (propagate_event_target and parent.type.id == 'EventTarget')): | 269 (propagate_event_target and parent.type.id == 'EventTarget')): |
| 272 walk(interface.parents) | 270 walk(interface.parents) |
| 273 else: | 271 else: |
| 274 walk(interface.parents[1:]) | 272 walk(interface.parents[1:]) |
| 275 return result | 273 return result |
| 276 | 274 |
| OLD | NEW |