| 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 self._database.HasInterface(interface.id): | 433 if not interface.is_supplemental: |
| 434 if import_options.add_new_interfaces: | 434 if self._database.HasInterface(interface.id): |
| 435 self._database.AddInterface(interface) | 435 old_interface = self._database.GetInterface(interface.id) |
| 436 elif not interface.is_supplemental: | 436 self._merge_interfaces(old_interface, interface, import_options) |
| 437 old_interface = self._database.GetInterface(interface.id) | 437 else: |
| 438 self._merge_interfaces(old_interface, interface, | 438 if import_options.add_new_interfaces: |
| 439 import_options) | 439 self._database.AddInterface(interface) |
| 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 and self._database.HasInterface(interface.id)): | 444 # For now, ignore WebKit [Supplemental=BaseInterface] attributes. |
| 445 old_interface = self._database.GetInterface(interface.id) | 445 target = interface.ext_attrs['Supplemental'] |
| 446 self._merge_interfaces(old_interface, interface, | 446 if target: |
| 447 import_options) | 447 continue |
| 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) |
| 448 | 452 |
| 449 # Step 4: Resolve 'implements' statements | 453 # Step 4: Resolve 'implements' statements |
| 450 for impl_stmt, import_options in self._impl_stmts: | 454 for impl_stmt, import_options in self._impl_stmts: |
| 451 self._merge_impl_stmt(impl_stmt, import_options) | 455 self._merge_impl_stmt(impl_stmt, import_options) |
| 452 | 456 |
| 453 self._impl_stmts = [] | 457 self._impl_stmts = [] |
| 454 self._imported_interfaces = [] | 458 self._imported_interfaces = [] |
| 455 | 459 |
| 456 def import_idl_file(self, file_path, | 460 def import_idl_file(self, file_path, |
| 457 import_options=DatabaseBuilderOptions()): | 461 import_options=DatabaseBuilderOptions()): |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 for name, value in annotation.items(): | 555 for name, value in annotation.items(): |
| 552 if (name in top_level_annotation | 556 if (name in top_level_annotation |
| 553 and value == top_level_annotation[name]): | 557 and value == top_level_annotation[name]): |
| 554 del annotation[name] | 558 del annotation[name] |
| 555 | 559 |
| 556 map(normalize, interface.parents) | 560 map(normalize, interface.parents) |
| 557 map(normalize, interface.constants) | 561 map(normalize, interface.constants) |
| 558 map(normalize, interface.attributes) | 562 map(normalize, interface.attributes) |
| 559 map(normalize, interface.operations) | 563 map(normalize, interface.operations) |
| 560 map(normalize, interface.snippets) | 564 map(normalize, interface.snippets) |
| OLD | NEW |