OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, 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 """This module provides shared functionality to provide Dart metadata for | 6 """This module provides shared functionality to provide Dart metadata for |
7 DOM APIs. | 7 DOM APIs. |
8 """ | 8 """ |
9 | 9 |
10 import copy | 10 import copy |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 annotations = self.GetMetadata(library_name, interface, member_name) | 592 annotations = self.GetMetadata(library_name, interface, member_name) |
593 | 593 |
594 ann2 = self._GetDart2JSSpecificAnnotations(idl_type, interface.id, member_na
me) | 594 ann2 = self._GetDart2JSSpecificAnnotations(idl_type, interface.id, member_na
me) |
595 if ann2: | 595 if ann2: |
596 if annotations: | 596 if annotations: |
597 annotations.extend(ann2) | 597 annotations.extend(ann2) |
598 else: | 598 else: |
599 annotations = ann2 | 599 annotations = ann2 |
600 return annotations | 600 return annotations |
601 | 601 |
| 602 def IsDeprecated(self, interface, member_name): |
| 603 annotations = self._GetSupportLevelAnnotations(interface.id, member_name) |
| 604 return any( |
| 605 annotation.startswith('@deprecated') for annotation in annotations) |
| 606 |
602 def _GetCommonAnnotations(self, interface, member_name=None, | 607 def _GetCommonAnnotations(self, interface, member_name=None, |
603 source_member_name=None): | 608 source_member_name=None): |
604 if member_name: | 609 if member_name: |
605 key = '%s.%s' % (interface.id, member_name) | 610 key = '%s.%s' % (interface.id, member_name) |
606 dom_name = '%s.%s' % (interface.javascript_binding_name, member_name) | 611 dom_name = '%s.%s' % (interface.javascript_binding_name, member_name) |
607 else: | 612 else: |
608 key = interface.id | 613 key = interface.id |
609 dom_name = interface.javascript_binding_name | 614 dom_name = interface.javascript_binding_name |
610 | 615 |
611 annotations = ["@DomName('" + dom_name + "')"] | 616 annotations = ["@DomName('" + dom_name + "')"] |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 pass | 780 pass |
776 else: | 781 else: |
777 _logger.warn('Unknown support_level - %s:%s' % (interface_id, member_id)) | 782 _logger.warn('Unknown support_level - %s:%s' % (interface_id, member_id)) |
778 | 783 |
779 return annotations | 784 return annotations |
780 | 785 |
781 def Flush(self): | 786 def Flush(self): |
782 json_file = open(self._api_status_path, 'w+') | 787 json_file = open(self._api_status_path, 'w+') |
783 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key
s=True) | 788 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key
s=True) |
784 json_file.close() | 789 json_file.close() |
OLD | NEW |