| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 idl_node.is_fc_suppressed): | 174 idl_node.is_fc_suppressed): |
| 175 annotation['suppressed'] = None | 175 annotation['suppressed'] = None |
| 176 | 176 |
| 177 add_source_annotation(interface) | 177 add_source_annotation(interface) |
| 178 interface.annotations[source][_MODULE_ANNOTATION_ATTR_NAME] = module_name | 178 interface.annotations[source][_MODULE_ANNOTATION_ATTR_NAME] = module_name |
| 179 | 179 |
| 180 map(add_source_annotation, interface.parents) | 180 map(add_source_annotation, interface.parents) |
| 181 map(add_source_annotation, interface.constants) | 181 map(add_source_annotation, interface.constants) |
| 182 map(add_source_annotation, interface.attributes) | 182 map(add_source_annotation, interface.attributes) |
| 183 map(add_source_annotation, interface.operations) | 183 map(add_source_annotation, interface.operations) |
| 184 map(add_source_annotation, interface.snippets) | |
| 185 | 184 |
| 186 def _sign(self, node): | 185 def _sign(self, node): |
| 187 """Computes a unique signature for the node, for merging purposed, by | 186 """Computes a unique signature for the node, for merging purposed, by |
| 188 concatenating types and names in the declaration.""" | 187 concatenating types and names in the declaration.""" |
| 189 if isinstance(node, IDLType): | 188 if isinstance(node, IDLType): |
| 190 res = node.id | 189 res = node.id |
| 191 if res.startswith('unsigned '): | 190 if res.startswith('unsigned '): |
| 192 res = res[len('unsigned '):] | 191 res = res[len('unsigned '):] |
| 193 if res in self._same_signatures: | 192 if res in self._same_signatures: |
| 194 res = self._same_signatures[res] | 193 res = self._same_signatures[res] |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 if merge_list('constants'): | 364 if merge_list('constants'): |
| 366 changed = True | 365 changed = True |
| 367 if merge_list('attributes'): | 366 if merge_list('attributes'): |
| 368 changed = True | 367 changed = True |
| 369 if merge_list('operations'): | 368 if merge_list('operations'): |
| 370 changed = True | 369 changed = True |
| 371 | 370 |
| 372 if self._merge_ext_attrs(old_interface.ext_attrs, new_interface.ext_attrs): | 371 if self._merge_ext_attrs(old_interface.ext_attrs, new_interface.ext_attrs): |
| 373 changed = True | 372 changed = True |
| 374 | 373 |
| 375 # Snippets are just concatentated: | |
| 376 if new_interface.snippets: | |
| 377 old_interface.snippets.extend( | |
| 378 copy.deepcopy(new_interface.snippets)) | |
| 379 changed = True | |
| 380 | |
| 381 _logger.info('merged interface %s (changed=%s, supplemental=%s)' % | 374 _logger.info('merged interface %s (changed=%s, supplemental=%s)' % |
| 382 (old_interface.id, changed, new_interface.is_supplemental)) | 375 (old_interface.id, changed, new_interface.is_supplemental)) |
| 383 | 376 |
| 384 return changed | 377 return changed |
| 385 | 378 |
| 386 def _merge_impl_stmt(self, impl_stmt, import_options): | 379 def _merge_impl_stmt(self, impl_stmt, import_options): |
| 387 """Applies "X implements Y" statemetns on the proper places in the | 380 """Applies "X implements Y" statemetns on the proper places in the |
| 388 database""" | 381 database""" |
| 389 implementor_name = impl_stmt.implementor.id | 382 implementor_name = impl_stmt.implementor.id |
| 390 implemented_name = impl_stmt.implemented.id | 383 implemented_name = impl_stmt.implemented.id |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 annotation = idl_node.annotations[source] | 547 annotation = idl_node.annotations[source] |
| 555 for name, value in annotation.items(): | 548 for name, value in annotation.items(): |
| 556 if (name in top_level_annotation | 549 if (name in top_level_annotation |
| 557 and value == top_level_annotation[name]): | 550 and value == top_level_annotation[name]): |
| 558 del annotation[name] | 551 del annotation[name] |
| 559 | 552 |
| 560 map(normalize, interface.parents) | 553 map(normalize, interface.parents) |
| 561 map(normalize, interface.constants) | 554 map(normalize, interface.constants) |
| 562 map(normalize, interface.attributes) | 555 map(normalize, interface.attributes) |
| 563 map(normalize, interface.operations) | 556 map(normalize, interface.operations) |
| 564 map(normalize, interface.snippets) | |
| OLD | NEW |