| 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 import copy | 6 import copy |
| 7 import database | 7 import database |
| 8 import idlparser | 8 import idlparser |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 def merge_imported_interfaces(self, optional_argument_whitelist): | 423 def merge_imported_interfaces(self, optional_argument_whitelist): |
| 424 """Merges all imported interfaces and loads them into the DB.""" | 424 """Merges all imported interfaces and loads them into the DB.""" |
| 425 | 425 |
| 426 # Step 1: Pre process imported interfaces | 426 # Step 1: Pre process imported interfaces |
| 427 for interface, module_name, import_options in self._imported_interfaces: | 427 for interface, module_name, import_options in self._imported_interfaces: |
| 428 self._split_declarations(interface, optional_argument_whitelist) | 428 self._split_declarations(interface, optional_argument_whitelist) |
| 429 self._annotate(interface, module_name, import_options) | 429 self._annotate(interface, module_name, import_options) |
| 430 | 430 |
| 431 # Step 2: Add all new interfaces and merge overlapping ones | 431 # Step 2: Add all new interfaces and merge overlapping ones |
| 432 for interface, module_name, import_options in self._imported_interfaces: | 432 for interface, module_name, import_options in self._imported_interfaces: |
| 433 if not interface.is_supplemental: | 433 if not self._database.HasInterface(interface.id): |
| 434 if self._database.HasInterface(interface.id): | 434 if import_options.add_new_interfaces: |
| 435 old_interface = self._database.GetInterface(interface.id) | 435 self._database.AddInterface(interface) |
| 436 self._merge_interfaces(old_interface, interface, import_options) | 436 elif not interface.is_supplemental: |
| 437 else: | 437 old_interface = self._database.GetInterface(interface.id) |
| 438 if import_options.add_new_interfaces: | 438 self._merge_interfaces(old_interface, interface, |
| 439 self._database.AddInterface(interface) | 439 import_options) |
| 440 | 440 |
| 441 # Step 3: Merge in supplemental interfaces | 441 # Step 3: Merge in supplemental interfaces |
| 442 for interface, module_name, import_options in self._imported_interfaces: | 442 for interface, module_name, import_options in self._imported_interfaces: |
| 443 if interface.is_supplemental: | 443 if (interface.is_supplemental |
| 444 # For now, ignore WebKit [Supplemental=BaseInterface] attributes. | 444 and self._database.HasInterface(interface.id)): |
| 445 target = interface.ext_attrs['Supplemental'] | 445 old_interface = self._database.GetInterface(interface.id) |
| 446 if target: | 446 self._merge_interfaces(old_interface, interface, |
| 447 continue | 447 import_options) |
| 448 target = interface.id | |
| 449 if self._database.HasInterface(target): | |
| 450 old_interface = self._database.GetInterface(target) | |
| 451 self._merge_interfaces(old_interface, interface, import_options) | |
| 452 | 448 |
| 453 # Step 4: Resolve 'implements' statements | 449 # Step 4: Resolve 'implements' statements |
| 454 for impl_stmt, import_options in self._impl_stmts: | 450 for impl_stmt, import_options in self._impl_stmts: |
| 455 self._merge_impl_stmt(impl_stmt, import_options) | 451 self._merge_impl_stmt(impl_stmt, import_options) |
| 456 | 452 |
| 457 self._impl_stmts = [] | 453 self._impl_stmts = [] |
| 458 self._imported_interfaces = [] | 454 self._imported_interfaces = [] |
| 459 | 455 |
| 460 def import_idl_file(self, file_path, | 456 def import_idl_file(self, file_path, |
| 461 import_options=DatabaseBuilderOptions()): | 457 import_options=DatabaseBuilderOptions()): |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 for name, value in annotation.items(): | 551 for name, value in annotation.items(): |
| 556 if (name in top_level_annotation | 552 if (name in top_level_annotation |
| 557 and value == top_level_annotation[name]): | 553 and value == top_level_annotation[name]): |
| 558 del annotation[name] | 554 del annotation[name] |
| 559 | 555 |
| 560 map(normalize, interface.parents) | 556 map(normalize, interface.parents) |
| 561 map(normalize, interface.constants) | 557 map(normalize, interface.constants) |
| 562 map(normalize, interface.attributes) | 558 map(normalize, interface.attributes) |
| 563 map(normalize, interface.operations) | 559 map(normalize, interface.operations) |
| 564 map(normalize, interface.snippets) | 560 map(normalize, interface.snippets) |
| OLD | NEW |