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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 annotations = self.GetMetadata(library_name, interface, member_name) | 640 annotations = self.GetMetadata(library_name, interface, member_name) |
641 | 641 |
642 ann2 = self._GetDart2JSSpecificAnnotations(idl_type, interface.id, member_na
me) | 642 ann2 = self._GetDart2JSSpecificAnnotations(idl_type, interface.id, member_na
me) |
643 if ann2: | 643 if ann2: |
644 if annotations: | 644 if annotations: |
645 annotations.extend(ann2) | 645 annotations.extend(ann2) |
646 else: | 646 else: |
647 annotations = ann2 | 647 annotations = ann2 |
648 return annotations | 648 return annotations |
649 | 649 |
650 def IsDeprecated(self, interface, member_name): | 650 def IsSuppressed(self, interface, member_name): |
651 annotations = self._GetSupportLevelAnnotations(interface.id, member_name) | 651 annotations = self._GetSupportLevelAnnotations(interface.id, member_name) |
652 return any( | 652 return any( |
653 annotation.startswith('@deprecated') for annotation in annotations) | 653 annotation.startswith('@removed') for annotation in annotations) |
654 | 654 |
655 def _GetCommonAnnotations(self, interface, member_name=None, | 655 def _GetCommonAnnotations(self, interface, member_name=None, |
656 source_member_name=None): | 656 source_member_name=None): |
657 if member_name: | 657 if member_name: |
658 key = '%s.%s' % (interface.id, member_name) | 658 key = '%s.%s' % (interface.id, member_name) |
659 dom_name = '%s.%s' % (interface.javascript_binding_name, member_name) | 659 dom_name = '%s.%s' % (interface.javascript_binding_name, member_name) |
660 else: | 660 else: |
661 key = interface.id | 661 key = interface.id |
662 dom_name = interface.javascript_binding_name | 662 dom_name = interface.javascript_binding_name |
663 | 663 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 if dart_action: | 794 if dart_action: |
795 if dart_action == 'unstable': | 795 if dart_action == 'unstable': |
796 annotations.append('@Unstable()') | 796 annotations.append('@Unstable()') |
797 elif dart_action == 'experimental': | 797 elif dart_action == 'experimental': |
798 if comment: | 798 if comment: |
799 annotations.append('// %s' % comment) | 799 annotations.append('// %s' % comment) |
800 annotations.append('@Experimental() // %s' % support_level) | 800 annotations.append('@Experimental() // %s' % support_level) |
801 elif dart_action == 'suppress': | 801 elif dart_action == 'suppress': |
802 if comment: | 802 if comment: |
803 annotations.append('// %s' % comment) | 803 annotations.append('// %s' % comment) |
804 annotations.append('@deprecated // %s' % support_level) | 804 anAnnotation = 'deprecated' |
805 # TODO (blois): suppress generation of these APIs as a separate CL. | 805 if member_id: |
| 806 anAnnotation = 'removed' |
| 807 annotations.append('@%s // %s' % (anAnnotation, support_level)) |
806 pass | 808 pass |
807 elif dart_action == 'stable': | 809 elif dart_action == 'stable': |
808 pass | 810 pass |
809 else: | 811 else: |
810 _logger.warn('Unknown dart_action - %s:%s' % (interface_id, member_id)) | 812 _logger.warn('Unknown dart_action - %s:%s' % (interface_id, member_id)) |
811 elif support_level == 'untriaged': | 813 elif support_level == 'untriaged': |
812 annotations.append('@Experimental() // untriaged') | 814 annotations.append('@Experimental() // untriaged') |
813 elif support_level == 'experimental': | 815 elif support_level == 'experimental': |
814 if comment: | 816 if comment: |
815 annotations.append('// %s' % comment) | 817 annotations.append('// %s' % comment) |
(...skipping 12 matching lines...) Expand all Loading... |
828 pass | 830 pass |
829 else: | 831 else: |
830 _logger.warn('Unknown support_level - %s:%s' % (interface_id, member_id)) | 832 _logger.warn('Unknown support_level - %s:%s' % (interface_id, member_id)) |
831 | 833 |
832 return annotations | 834 return annotations |
833 | 835 |
834 def Flush(self): | 836 def Flush(self): |
835 json_file = open(self._api_status_path, 'w+') | 837 json_file = open(self._api_status_path, 'w+') |
836 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key
s=True) | 838 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key
s=True) |
837 json_file.close() | 839 json_file.close() |
OLD | NEW |