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 | |
607 def _GetCommonAnnotations(self, interface, member_name=None, | 602 def _GetCommonAnnotations(self, interface, member_name=None, |
608 source_member_name=None): | 603 source_member_name=None): |
609 if member_name: | 604 if member_name: |
610 key = '%s.%s' % (interface.id, member_name) | 605 key = '%s.%s' % (interface.id, member_name) |
611 dom_name = '%s.%s' % (interface.javascript_binding_name, member_name) | 606 dom_name = '%s.%s' % (interface.javascript_binding_name, member_name) |
612 else: | 607 else: |
613 key = interface.id | 608 key = interface.id |
614 dom_name = interface.javascript_binding_name | 609 dom_name = interface.javascript_binding_name |
615 | 610 |
616 annotations = ["@DomName('" + dom_name + "')"] | 611 annotations = ["@DomName('" + dom_name + "')"] |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 pass | 775 pass |
781 else: | 776 else: |
782 _logger.warn('Unknown support_level - %s:%s' % (interface_id, member_id)) | 777 _logger.warn('Unknown support_level - %s:%s' % (interface_id, member_id)) |
783 | 778 |
784 return annotations | 779 return annotations |
785 | 780 |
786 def Flush(self): | 781 def Flush(self): |
787 json_file = open(self._api_status_path, 'w+') | 782 json_file = open(self._api_status_path, 'w+') |
788 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key
s=True) | 783 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key
s=True) |
789 json_file.close() | 784 json_file.close() |
OLD | NEW |