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

Side by Side Diff: client/dom/scripts/databasebuilder.py

Issue 9310119: Add ImplementedBy attribute for operations merged from [Supplemental=XXX] interfaces. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 if not interface.is_supplemental: 440 if not interface.is_supplemental:
441 if self._database.HasInterface(interface.id): 441 if self._database.HasInterface(interface.id):
442 old_interface = self._database.GetInterface(interface.id) 442 old_interface = self._database.GetInterface(interface.id)
443 self._merge_interfaces(old_interface, interface, import_options) 443 self._merge_interfaces(old_interface, interface, import_options)
444 else: 444 else:
445 if import_options.add_new_interfaces: 445 if import_options.add_new_interfaces:
446 self._database.AddInterface(interface) 446 self._database.AddInterface(interface)
447 447
448 # Step 3: Merge in supplemental interfaces 448 # Step 3: Merge in supplemental interfaces
449 for interface, module_name, import_options in self._imported_interfaces: 449 for interface, module_name, import_options in self._imported_interfaces:
450 if interface.is_supplemental: 450 if not interface.is_supplemental:
451 target_name = interface.ext_attrs['Supplemental'] 451 continue
452 if target_name: 452
453 # [Supplemental=DOMWindow] - merge into DOMWindow. 453 target_name = interface.ext_attrs['Supplemental'] or interface.id
454 target = target_name 454 if not self._database.HasInterface(target_name):
455 else: 455 raise Exception("Supplemental target '%s' not found", target_name)
456 # [Supplemental] - merge into existing inteface with same name. 456 target_interface = self._database.GetInterface(target_name)
457 target = interface.id 457 self._merge_interfaces(target_interface, interface, import_options)
458 if self._database.HasInterface(target): 458
459 old_interface = self._database.GetInterface(target) 459 if target_name == interface.id:
460 self._merge_interfaces(old_interface, interface, import_options) 460 # [Supplemental] - merged into existing inteface with same name.
461 else: 461 continue
462 raise Exception("Supplemental target '%s' not found", target) 462
463 # [Supplemental=DOMWindow] - merged into DOMWindow. Mark operations and
464 # attributes as [ImplementedBy=Interface]
465 attributes = set([attribute.id for attribute in interface.attributes])
466 for attribute in target_interface.attributes:
467 if attribute.id in attributes:
468 attribute.ext_attrs['ImplementedBy'] = interface.id
469 operations = set([operation.id for operation in interface.operations])
470 for operation in target_interface.operations:
471 if operation.id in operations:
sra1 2012/02/06 18:14:36 Is it possible that foo(int) is implemented by I1
472 operation.ext_attrs['ImplementedBy'] = interface.id
463 473
464 # Step 4: Resolve 'implements' statements 474 # Step 4: Resolve 'implements' statements
465 for impl_stmt, import_options in self._impl_stmts: 475 for impl_stmt, import_options in self._impl_stmts:
466 self._merge_impl_stmt(impl_stmt, import_options) 476 self._merge_impl_stmt(impl_stmt, import_options)
467 477
468 self._impl_stmts = [] 478 self._impl_stmts = []
469 self._imported_interfaces = [] 479 self._imported_interfaces = []
470 480
471 def import_idl_file(self, file_path, 481 def import_idl_file(self, file_path,
472 import_options=DatabaseBuilderOptions()): 482 import_options=DatabaseBuilderOptions()):
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 annotation = idl_node.annotations[source] 605 annotation = idl_node.annotations[source]
596 for name, value in annotation.items(): 606 for name, value in annotation.items():
597 if (name in top_level_annotation 607 if (name in top_level_annotation
598 and value == top_level_annotation[name]): 608 and value == top_level_annotation[name]):
599 del annotation[name] 609 del annotation[name]
600 610
601 map(normalize, interface.parents) 611 map(normalize, interface.parents)
602 map(normalize, interface.constants) 612 map(normalize, interface.constants)
603 map(normalize, interface.attributes) 613 map(normalize, interface.attributes)
604 map(normalize, interface.operations) 614 map(normalize, interface.operations)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698