Chromium Code Reviews| 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 for systems to generate | 6 """This module provides shared functionality for systems to generate |
| 7 Dart APIs from the IDL database.""" | 7 Dart APIs from the IDL database.""" |
| 8 | 8 |
| 9 import copy | 9 import copy |
| 10 import re | 10 import re |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 602 | 602 |
| 603 def interface_name(self): | 603 def interface_name(self): |
| 604 raise NotImplementedError() | 604 raise NotImplementedError() |
| 605 | 605 |
| 606 def implementation_name(self): | 606 def implementation_name(self): |
| 607 raise NotImplementedError() | 607 raise NotImplementedError() |
| 608 | 608 |
| 609 def has_generated_interface(self): | 609 def has_generated_interface(self): |
| 610 raise NotImplementedError() | 610 raise NotImplementedError() |
| 611 | 611 |
| 612 def is_list_like(self): | |
| 613 raise NotImplementedError() | |
| 614 | |
| 615 def list_item_type(self): | |
| 616 raise NotImplementedError() | |
| 617 | |
| 612 def merged_interface(self): | 618 def merged_interface(self): |
| 613 return None | 619 return None |
| 614 | 620 |
| 615 def merged_into(self): | 621 def merged_into(self): |
| 616 return None | 622 return None |
| 617 | 623 |
| 618 def native_type(self): | 624 def native_type(self): |
| 619 return self._data.native_type or self._idl_type | 625 return self._data.native_type or self._idl_type |
| 620 | 626 |
| 621 def bindings_class(self): | 627 def bindings_class(self): |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 689 return ['"Dart%s.h"' % include for include in includes] | 695 return ['"Dart%s.h"' % include for include in includes] |
| 690 | 696 |
| 691 def to_dart_conversion(self, value, interface_name=None, attributes=None): | 697 def to_dart_conversion(self, value, interface_name=None, attributes=None): |
| 692 return 'Dart%s::toDart(%s)' % (self._idl_type, value) | 698 return 'Dart%s::toDart(%s)' % (self._idl_type, value) |
| 693 | 699 |
| 694 def custom_to_dart(self): | 700 def custom_to_dart(self): |
| 695 return self._data.custom_to_dart | 701 return self._data.custom_to_dart |
| 696 | 702 |
| 697 | 703 |
| 698 class InterfaceIDLTypeInfo(IDLTypeInfo): | 704 class InterfaceIDLTypeInfo(IDLTypeInfo): |
| 699 def __init__(self, idl_type, data, dart_interface_name): | 705 def __init__(self, idl_type, data, dart_interface_name, type_registry): |
| 700 super(InterfaceIDLTypeInfo, self).__init__(idl_type, data) | 706 super(InterfaceIDLTypeInfo, self).__init__(idl_type, data) |
| 701 self._dart_interface_name = dart_interface_name | 707 self._dart_interface_name = dart_interface_name |
| 708 self._type_registry = type_registry | |
| 702 | 709 |
| 703 def dart_type(self): | 710 def dart_type(self): |
| 711 # TODO(podivilov): why NodeList is special? | |
| 712 if self.idl_type() == 'NodeList': | |
| 713 return 'List<Node>' | |
| 714 if self.is_list_like() and not self.has_generated_interface(): | |
| 715 return 'List<%s>' % self._type_registry.TypeInfo(self._data.item_type).dar t_type() | |
| 704 return self._data.dart_type or self._dart_interface_name | 716 return self._data.dart_type or self._dart_interface_name |
| 705 | 717 |
| 706 def narrow_dart_type(self): | 718 def narrow_dart_type(self): |
| 719 # TODO(podivilov): why NodeList is special? | |
| 720 if self.idl_type() == 'NodeList': | |
| 721 return 'List<Node>' | |
| 722 if self.is_list_like(): | |
| 723 return ImplementationClassNameForInterfaceName(self.idl_type()) | |
| 707 # TODO(podivilov): only primitive and collection types should override | 724 # TODO(podivilov): only primitive and collection types should override |
| 708 # dart_type. | 725 # dart_type. |
| 709 if self._data.dart_type != None: | 726 if self._data.dart_type != None: |
| 710 return self.dart_type() | 727 return self.dart_type() |
| 711 if IsPureInterface(self.idl_type()): | 728 if IsPureInterface(self.idl_type()): |
| 712 return self.idl_type() | 729 return self.idl_type() |
| 713 return ImplementationClassNameForInterfaceName(self.interface_name()) | 730 return ImplementationClassNameForInterfaceName(self.interface_name()) |
| 714 | 731 |
| 715 def interface_name(self): | 732 def interface_name(self): |
| 733 if self.is_list_like() and not self.has_generated_interface(): | |
| 734 return self.dart_type() | |
| 716 return self._dart_interface_name | 735 return self._dart_interface_name |
| 717 | 736 |
| 718 def implementation_name(self): | 737 def implementation_name(self): |
| 738 if self.is_list_like(): | |
| 739 return ImplementationClassNameForInterfaceName(self.idl_type()) | |
| 719 implementation_name = ImplementationClassNameForInterfaceName( | 740 implementation_name = ImplementationClassNameForInterfaceName( |
| 720 self.interface_name()) | 741 self.interface_name()) |
| 721 if self.merged_into(): | 742 if self.merged_into(): |
| 722 implementation_name = '%s_Merged' % implementation_name | 743 implementation_name = '%s_Merged' % implementation_name |
| 723 return implementation_name | 744 return implementation_name |
| 724 | 745 |
| 725 def has_generated_interface(self): | 746 def has_generated_interface(self): |
| 726 return True | 747 return not self._data.suppress_interface |
| 748 | |
| 749 def is_list_like(self): | |
| 750 return self._data.list_like | |
| 751 | |
| 752 def list_item_type(self): | |
| 753 return self._data.item_type | |
| 727 | 754 |
| 728 def merged_interface(self): | 755 def merged_interface(self): |
| 729 # All constants, attributes, and operations of merged interface should be | 756 # All constants, attributes, and operations of merged interface should be |
| 730 # added to this interface. Merged idl interface does not have corresponding | 757 # added to this interface. Merged idl interface does not have corresponding |
| 731 # Dart generated interface, and all references to merged idl interface | 758 # Dart generated interface, and all references to merged idl interface |
| 732 # (e.g. parameter types, return types, parent interfaces) should be replaced | 759 # (e.g. parameter types, return types, parent interfaces) should be replaced |
| 733 # with this interface. There are two important restrictions: | 760 # with this interface. There are two important restrictions: |
| 734 # 1) Merged and target interfaces shouldn't have common members, otherwise | 761 # 1) Merged and target interfaces shouldn't have common members, otherwise |
| 735 # there would be duplicated declarations in generated Dart code. | 762 # there would be duplicated declarations in generated Dart code. |
| 736 # 2) Merged interface should be direct child of target interface, so the | 763 # 2) Merged interface should be direct child of target interface, so the |
| 737 # children of merged interface are not affected by the merge. | 764 # children of merged interface are not affected by the merge. |
| 738 # As a consequence, target interface implementation and its direct children | 765 # As a consequence, target interface implementation and its direct children |
| 739 # interface implementations should implement merged attribute accessors and | 766 # interface implementations should implement merged attribute accessors and |
| 740 # operations. For example, SVGElement and Element implementation classes | 767 # operations. For example, SVGElement and Element implementation classes |
| 741 # should implement HTMLElement.insertAdjacentElement(), | 768 # should implement HTMLElement.insertAdjacentElement(), |
| 742 # HTMLElement.innerHTML, etc. | 769 # HTMLElement.innerHTML, etc. |
| 743 return self._data.merged_interface | 770 return self._data.merged_interface |
| 744 | 771 |
| 745 def merged_into(self): | 772 def merged_into(self): |
| 746 return self._data.merged_into | 773 return self._data.merged_into |
| 747 | 774 |
| 748 | 775 |
| 749 class CallbackIDLTypeInfo(IDLTypeInfo): | 776 class CallbackIDLTypeInfo(IDLTypeInfo): |
| 750 def __init__(self, idl_type, data): | 777 def __init__(self, idl_type, data): |
| 751 super(CallbackIDLTypeInfo, self).__init__(idl_type, data) | 778 super(CallbackIDLTypeInfo, self).__init__(idl_type, data) |
| 752 | 779 |
| 753 | 780 |
| 754 # Type info for DOM types that are converted to dart lists and therefore whose | |
| 755 # actual interface generation should be suppressed. For type information, we | |
| 756 # still generate the implementations though, so these types should not be | |
| 757 # suppressed entirely. | |
| 758 class ListLikeIDLTypeInfo(IDLTypeInfo): | |
| 759 def __init__(self, idl_type, data, item_info): | |
| 760 super(ListLikeIDLTypeInfo, self).__init__(idl_type, data) | |
| 761 self._item_info = item_info | |
| 762 | |
| 763 def dart_type(self): | |
| 764 return 'List<%s>' % self._item_info.dart_type() | |
| 765 | |
| 766 def narrow_dart_type(self): | |
| 767 if self.has_generated_interface(): | |
| 768 return self.dart_type() | |
| 769 return ImplementationClassNameForInterfaceName(self.idl_type()) | |
| 770 | |
| 771 def interface_name(self): | |
| 772 if self.has_generated_interface(): | |
| 773 return self.idl_type() | |
| 774 return self.dart_type() | |
| 775 | |
| 776 def implementation_name(self): | |
| 777 return ImplementationClassNameForInterfaceName(self.idl_type()) | |
| 778 | |
| 779 def has_generated_interface(self): | |
| 780 # Don't generate interfaces for list-like types. | |
| 781 # TODO(podivilov): why NodeList is special? Is it indeed a list-like type | |
| 782 # or should just implement sequence<Node>? | |
| 783 return self.idl_type() == 'NodeList' | |
| 784 | |
| 785 | |
| 786 class SequenceIDLTypeInfo(IDLTypeInfo): | 781 class SequenceIDLTypeInfo(IDLTypeInfo): |
| 787 def __init__(self, idl_type, data, item_info): | 782 def __init__(self, idl_type, data, item_info): |
| 788 super(SequenceIDLTypeInfo, self).__init__(idl_type, data) | 783 super(SequenceIDLTypeInfo, self).__init__(idl_type, data) |
| 789 self._item_info = item_info | 784 self._item_info = item_info |
| 790 | 785 |
| 791 def dart_type(self): | 786 def dart_type(self): |
| 792 return 'List<%s>' % self._item_info.dart_type() | 787 return 'List<%s>' % self._item_info.dart_type() |
| 793 | 788 |
| 794 def interface_name(self): | 789 def interface_name(self): |
| 795 return self.dart_type() | 790 return self.dart_type() |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 861 return self._data.webcore_getter_name | 856 return self._data.webcore_getter_name |
| 862 | 857 |
| 863 def webcore_setter_name(self): | 858 def webcore_setter_name(self): |
| 864 return self._data.webcore_setter_name | 859 return self._data.webcore_setter_name |
| 865 | 860 |
| 866 def _capitalized_native_type(self): | 861 def _capitalized_native_type(self): |
| 867 return re.sub(r'(^| )([a-z])', lambda x: x.group(2).upper(), self.native_typ e()) | 862 return re.sub(r'(^| )([a-z])', lambda x: x.group(2).upper(), self.native_typ e()) |
| 868 | 863 |
| 869 | 864 |
| 870 class SVGTearOffIDLTypeInfo(InterfaceIDLTypeInfo): | 865 class SVGTearOffIDLTypeInfo(InterfaceIDLTypeInfo): |
| 871 def __init__(self, idl_type, data): | 866 def __init__(self, idl_type, data, type_registry): |
| 872 super(SVGTearOffIDLTypeInfo, self).__init__(idl_type, data, idl_type) | 867 super(SVGTearOffIDLTypeInfo, self).__init__( |
| 868 idl_type, data, idl_type, type_registry) | |
| 873 | 869 |
| 874 def native_type(self): | 870 def native_type(self): |
| 875 if self._data.native_type: | 871 if self._data.native_type: |
| 876 return self._data.native_type | 872 return self._data.native_type |
| 877 tear_off_type = 'SVGPropertyTearOff' | 873 tear_off_type = 'SVGPropertyTearOff' |
| 878 if self._idl_type.endswith('List'): | 874 if self._idl_type.endswith('List'): |
| 879 tear_off_type = 'SVGListPropertyTearOff' | 875 tear_off_type = 'SVGListPropertyTearOff' |
| 880 return '%s<%s>' % (tear_off_type, self._idl_type) | 876 return '%s<%s>' % (tear_off_type, self._idl_type) |
| 881 | 877 |
| 882 def receiver(self): | 878 def receiver(self): |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 906 | 902 |
| 907 | 903 |
| 908 class TypeData(object): | 904 class TypeData(object): |
| 909 def __init__(self, clazz, dart_type=None, native_type=None, | 905 def __init__(self, clazz, dart_type=None, native_type=None, |
| 910 merged_interface=None, merged_into=None, | 906 merged_interface=None, merged_into=None, |
| 911 custom_to_dart=None, custom_to_native=None, | 907 custom_to_dart=None, custom_to_native=None, |
| 912 conversion_includes=None, | 908 conversion_includes=None, |
| 913 webcore_getter_name='getAttribute', | 909 webcore_getter_name='getAttribute', |
| 914 webcore_setter_name='setAttribute', | 910 webcore_setter_name='setAttribute', |
| 915 requires_v8_scope=False, | 911 requires_v8_scope=False, |
| 916 item_type=None): | 912 list_like=False, item_type=None, suppress_interface=False): |
|
Anton Muhin
2012/10/22 12:19:18
cannot we assume item_type is None <=> not list_li
podivilov
2012/10/22 12:32:59
Done.
| |
| 917 self.clazz = clazz | 913 self.clazz = clazz |
| 918 self.dart_type = dart_type | 914 self.dart_type = dart_type |
| 919 self.native_type = native_type | 915 self.native_type = native_type |
| 920 self.merged_interface = merged_interface | 916 self.merged_interface = merged_interface |
| 921 self.merged_into = merged_into | 917 self.merged_into = merged_into |
| 922 self.custom_to_dart = custom_to_dart | 918 self.custom_to_dart = custom_to_dart |
| 923 self.custom_to_native = custom_to_native | 919 self.custom_to_native = custom_to_native |
| 924 self.conversion_includes = conversion_includes | 920 self.conversion_includes = conversion_includes |
| 925 self.webcore_getter_name = webcore_getter_name | 921 self.webcore_getter_name = webcore_getter_name |
| 926 self.webcore_setter_name = webcore_setter_name | 922 self.webcore_setter_name = webcore_setter_name |
| 927 self.requires_v8_scope = requires_v8_scope | 923 self.requires_v8_scope = requires_v8_scope |
| 924 self.list_like = list_like | |
| 928 self.item_type = item_type | 925 self.item_type = item_type |
| 926 self.suppress_interface = suppress_interface | |
| 929 | 927 |
| 930 | 928 |
| 931 _idl_type_registry = { | 929 _idl_type_registry = { |
| 932 'boolean': TypeData(clazz='Primitive', dart_type='bool', native_type='bool', | 930 'boolean': TypeData(clazz='Primitive', dart_type='bool', native_type='bool', |
| 933 webcore_getter_name='hasAttribute', | 931 webcore_getter_name='hasAttribute', |
| 934 webcore_setter_name='setBooleanAttribute'), | 932 webcore_setter_name='setBooleanAttribute'), |
| 935 'byte': TypeData(clazz='Primitive', dart_type='int', native_type='int'), | 933 'byte': TypeData(clazz='Primitive', dart_type='int', native_type='int'), |
| 936 'octet': TypeData(clazz='Primitive', dart_type='int', native_type='int'), | 934 'octet': TypeData(clazz='Primitive', dart_type='int', native_type='int'), |
| 937 'short': TypeData(clazz='Primitive', dart_type='int', native_type='int'), | 935 'short': TypeData(clazz='Primitive', dart_type='int', native_type='int'), |
| 938 'unsigned short': TypeData(clazz='Primitive', dart_type='int', | 936 'unsigned short': TypeData(clazz='Primitive', dart_type='int', |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 991 'HTMLDocument': TypeData(clazz='Interface', merged_into='Document'), | 989 'HTMLDocument': TypeData(clazz='Interface', merged_into='Document'), |
| 992 'HTMLElement': TypeData(clazz='Interface', merged_into='Element', | 990 'HTMLElement': TypeData(clazz='Interface', merged_into='Element', |
| 993 custom_to_dart=True), | 991 custom_to_dart=True), |
| 994 'IDBAny': TypeData(clazz='Interface', dart_type='Dynamic', custom_to_native= True), | 992 'IDBAny': TypeData(clazz='Interface', dart_type='Dynamic', custom_to_native= True), |
| 995 'IDBKey': TypeData(clazz='Interface', dart_type='Dynamic', custom_to_native= True), | 993 'IDBKey': TypeData(clazz='Interface', dart_type='Dynamic', custom_to_native= True), |
| 996 'MutationRecordArray': TypeData(clazz='Interface', # C++ pass by pointer. | 994 'MutationRecordArray': TypeData(clazz='Interface', # C++ pass by pointer. |
| 997 native_type='MutationRecordArray', dart_type='List<MutationRecord>'), | 995 native_type='MutationRecordArray', dart_type='List<MutationRecord>'), |
| 998 'StyleSheet': TypeData(clazz='Interface', conversion_includes=['CSSStyleShee t']), | 996 'StyleSheet': TypeData(clazz='Interface', conversion_includes=['CSSStyleShee t']), |
| 999 'SVGElement': TypeData(clazz='Interface', custom_to_dart=True), | 997 'SVGElement': TypeData(clazz='Interface', custom_to_dart=True), |
| 1000 | 998 |
| 1001 'ClientRectList': TypeData(clazz='ListLike', item_type='ClientRect'), | 999 'ClientRectList': TypeData(clazz='Interface', list_like=True, |
|
Anton Muhin
2012/10/22 12:19:18
maybe introduce a helper function?
podivilov
2012/10/22 12:32:59
Now that list_like is removed as you suggested, he
| |
| 1002 'CSSRuleList': TypeData(clazz='ListLike', item_type='CSSRule'), | 1000 item_type='ClientRect', suppress_interface=True), |
| 1003 'CSSValueList': TypeData(clazz='ListLike', item_type='CSSValue'), | 1001 'CSSRuleList': TypeData(clazz='Interface', list_like=True, |
| 1004 'DOMStringList': TypeData(clazz='ListLike', item_type='DOMString', | 1002 item_type='CSSRule', suppress_interface=True), |
| 1005 custom_to_native=True), | 1003 'CSSValueList': TypeData(clazz='Interface', list_like=True, |
| 1006 'EntryArray': TypeData(clazz='ListLike', item_type='Entry'), | 1004 item_type='CSSValue', suppress_interface=True), |
| 1007 'EntryArraySync': TypeData(clazz='ListLike', item_type='EntrySync'), | 1005 'DOMMimeTypeArray': TypeData(clazz='Interface', list_like=True, |
| 1008 'FileList': TypeData(clazz='ListLike', item_type='File'), | 1006 item_type='DOMMimeType'), |
| 1009 'GamepadList': TypeData(clazz='ListLike', item_type='Gamepad'), | 1007 'DOMPluginArray': TypeData(clazz='Interface', list_like=True, |
| 1010 'MediaStreamList': TypeData(clazz='ListLike', item_type='MediaStream'), | 1008 item_type='DOMPlugin'), |
| 1011 'NodeList': TypeData(clazz='ListLike', item_type='Node'), | 1009 'DOMStringList': TypeData(clazz='Interface', list_like=True, |
| 1012 'SVGElementInstanceList': TypeData(clazz='ListLike', | 1010 item_type='DOMString', suppress_interface=True, custom_to_native=True), |
| 1013 item_type='SVGElementInstance'), | 1011 'EntryArray': TypeData(clazz='Interface', list_like=True, |
| 1014 'SpeechInputResultList': TypeData(clazz='ListLike', | 1012 item_type='Entry', suppress_interface=True), |
| 1015 item_type='SpeechInputResult'), | 1013 'EntryArraySync': TypeData(clazz='Interface', list_like=True, |
| 1016 'SpeechRecognitionResultList': TypeData(clazz='ListLike', | 1014 item_type='EntrySync', suppress_interface=True), |
| 1017 item_type='SpeechRecognitionResult'), | 1015 'FileList': TypeData(clazz='Interface', list_like=True, |
| 1018 'StyleSheetList': TypeData(clazz='ListLike', item_type='StyleSheet'), | 1016 item_type='File', suppress_interface=True), |
| 1019 'WebKitAnimationList': TypeData(clazz='ListLike', | 1017 'GamepadList': TypeData(clazz='Interface', list_like=True, |
| 1020 item_type='WebKitAnimation'), | 1018 item_type='Gamepad', suppress_interface=True), |
| 1019 'HTMLAllCollection': TypeData(clazz='Interface', list_like=True, | |
| 1020 item_type='Node'), | |
| 1021 'HTMLCollection': TypeData(clazz='Interface', list_like=True, | |
| 1022 item_type='Node'), | |
| 1023 'MediaStreamList': TypeData(clazz='Interface', list_like=True, | |
| 1024 item_type='MediaStream', suppress_interface=True), | |
| 1025 'NamedNodeMap': TypeData(clazz='Interface', list_like=True, | |
| 1026 item_type='Node'), | |
| 1027 'NodeList': TypeData(clazz='Interface', list_like=True, item_type='Node'), | |
| 1028 'SVGAnimatedLengthList': TypeData(clazz='Interface', list_like=True, | |
| 1029 item_type='SVGAnimatedLength'), | |
| 1030 'SVGAnimatedNumberList': TypeData(clazz='Interface', list_like=True, | |
| 1031 item_type='SVGAnimatedNumber'), | |
| 1032 'SVGAnimatedTransformList': TypeData(clazz='Interface', list_like=True, | |
| 1033 item_type='SVGAnimateTransformElement'), | |
| 1034 'SVGElementInstanceList': TypeData(clazz='Interface', list_like=True, | |
| 1035 item_type='SVGElementInstance', suppress_interface=True), | |
| 1036 'SourceBufferList': TypeData(clazz='Interface', list_like=True, | |
| 1037 item_type='SourceBuffer'), | |
| 1038 'SpeechGrammarList': TypeData(clazz='Interface', list_like=True, | |
| 1039 item_type='SpeechGrammar'), | |
| 1040 'SpeechInputResultList': TypeData(clazz='Interface', list_like=True, | |
| 1041 item_type='SpeechInputResult', suppress_interface=True), | |
| 1042 'SpeechRecognitionResultList': TypeData(clazz='Interface', list_like=True, | |
| 1043 item_type='SpeechRecognitionResult', suppress_interface=True), | |
| 1044 'SQLResultSetRowList': TypeData(clazz='Interface', list_like=True, | |
| 1045 item_type='Dictionary'), | |
| 1046 'StyleSheetList': TypeData(clazz='Interface', list_like=True, | |
| 1047 item_type='StyleSheet', suppress_interface=True), | |
| 1048 'TextTrackCueList': TypeData(clazz='Interface', list_like=True, | |
| 1049 item_type='TextTrackCue'), | |
| 1050 'TextTrackList': TypeData(clazz='Interface', list_like=True, | |
| 1051 item_type='TextTrack'), | |
| 1052 'TouchList': TypeData(clazz='Interface', list_like=True, item_type='Touch'), | |
| 1053 'WebKitAnimationList': TypeData(clazz='Interface', list_like=True, | |
| 1054 item_type='WebKitAnimation', suppress_interface=True), | |
| 1055 | |
| 1056 'Float32Array': TypeData(clazz='Interface', list_like=True, | |
| 1057 item_type='double'), | |
| 1058 'Float64Array': TypeData(clazz='Interface', list_like=True, | |
| 1059 item_type='double'), | |
| 1060 'Int8Array': TypeData(clazz='Interface', list_like=True, item_type='int'), | |
| 1061 'Int16Array': TypeData(clazz='Interface', list_like=True, item_type='int'), | |
| 1062 'Int32Array': TypeData(clazz='Interface', list_like=True, item_type='int'), | |
| 1063 'Uint8Array': TypeData(clazz='Interface', list_like=True, item_type='int'), | |
| 1064 'Uint16Array': TypeData(clazz='Interface', list_like=True, item_type='int'), | |
| 1065 'Uint32Array': TypeData(clazz='Interface', list_like=True, item_type='int'), | |
| 1021 | 1066 |
| 1022 'SVGAngle': TypeData(clazz='SVGTearOff'), | 1067 'SVGAngle': TypeData(clazz='SVGTearOff'), |
| 1023 'SVGLength': TypeData(clazz='SVGTearOff'), | 1068 'SVGLength': TypeData(clazz='SVGTearOff'), |
| 1024 'SVGLengthList': TypeData(clazz='SVGTearOff'), | 1069 'SVGLengthList': TypeData(clazz='SVGTearOff', list_like=True, |
| 1070 item_type='SVGLength'), | |
| 1025 'SVGMatrix': TypeData(clazz='SVGTearOff'), | 1071 'SVGMatrix': TypeData(clazz='SVGTearOff'), |
| 1026 'SVGNumber': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff<fl oat>'), | 1072 'SVGNumber': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff<fl oat>'), |
| 1027 'SVGNumberList': TypeData(clazz='SVGTearOff'), | 1073 'SVGNumberList': TypeData(clazz='SVGTearOff', list_like=True, |
| 1028 'SVGPathSegList': TypeData(clazz='SVGTearOff', native_type='SVGPathSegListPr opertyTearOff'), | 1074 item_type='SVGNumber'), |
| 1075 'SVGPathSegList': TypeData(clazz='SVGTearOff', list_like=True, | |
| 1076 item_type='SVGPathSeg', native_type='SVGPathSegListPropertyTearOff'), | |
| 1029 'SVGPoint': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff<Flo atPoint>'), | 1077 'SVGPoint': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff<Flo atPoint>'), |
| 1030 'SVGPointList': TypeData(clazz='SVGTearOff'), | 1078 'SVGPointList': TypeData(clazz='SVGTearOff'), |
| 1031 'SVGPreserveAspectRatio': TypeData(clazz='SVGTearOff'), | 1079 'SVGPreserveAspectRatio': TypeData(clazz='SVGTearOff'), |
| 1032 'SVGRect': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff<Floa tRect>'), | 1080 'SVGRect': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff<Floa tRect>'), |
| 1033 'SVGStringList': TypeData(clazz='SVGTearOff', native_type='SVGStaticListProp ertyTearOff<SVGStringList>'), | 1081 'SVGStringList': TypeData(clazz='SVGTearOff', list_like=True, |
| 1082 item_type='DOMString', | |
| 1083 native_type='SVGStaticListPropertyTearOff<SVGStringList>'), | |
| 1034 'SVGTransform': TypeData(clazz='SVGTearOff'), | 1084 'SVGTransform': TypeData(clazz='SVGTearOff'), |
| 1035 'SVGTransformList': TypeData(clazz='SVGTearOff', native_type='SVGTransformLi stPropertyTearOff'), | 1085 'SVGTransformList': TypeData(clazz='SVGTearOff', list_like=True, |
| 1086 item_type='SVGTransform', | |
| 1087 native_type='SVGTransformListPropertyTearOff'), | |
| 1036 } | 1088 } |
| 1037 | 1089 |
| 1038 _svg_supplemental_includes = [ | 1090 _svg_supplemental_includes = [ |
| 1039 '"SVGAnimatedPropertyTearOff.h"', | 1091 '"SVGAnimatedPropertyTearOff.h"', |
| 1040 '"SVGAnimatedListPropertyTearOff.h"', | 1092 '"SVGAnimatedListPropertyTearOff.h"', |
| 1041 '"SVGStaticListPropertyTearOff.h"', | 1093 '"SVGStaticListPropertyTearOff.h"', |
| 1042 '"SVGAnimatedListPropertyTearOff.h"', | 1094 '"SVGAnimatedListPropertyTearOff.h"', |
| 1043 '"SVGTransformListPropertyTearOff.h"', | 1095 '"SVGTransformListPropertyTearOff.h"', |
| 1044 '"SVGPathSegListPropertyTearOff.h"', | 1096 '"SVGPathSegListPropertyTearOff.h"', |
| 1045 ] | 1097 ] |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 1066 item_info = self.TypeInfo(match.group(1) or match.group(2)) | 1118 item_info = self.TypeInfo(match.group(1) or match.group(2)) |
| 1067 return SequenceIDLTypeInfo(type_name, TypeData('Sequence'), item_info) | 1119 return SequenceIDLTypeInfo(type_name, TypeData('Sequence'), item_info) |
| 1068 | 1120 |
| 1069 if not type_name in _idl_type_registry: | 1121 if not type_name in _idl_type_registry: |
| 1070 interface = self._database.GetInterface(type_name) | 1122 interface = self._database.GetInterface(type_name) |
| 1071 if 'Callback' in interface.ext_attrs: | 1123 if 'Callback' in interface.ext_attrs: |
| 1072 return CallbackIDLTypeInfo(type_name, TypeData('Callback')) | 1124 return CallbackIDLTypeInfo(type_name, TypeData('Callback')) |
| 1073 return InterfaceIDLTypeInfo( | 1125 return InterfaceIDLTypeInfo( |
| 1074 type_name, | 1126 type_name, |
| 1075 TypeData('Interface'), | 1127 TypeData('Interface'), |
| 1076 self._renamer.RenameInterface(interface)) | 1128 self._renamer.RenameInterface(interface), |
| 1129 self) | |
| 1077 | 1130 |
| 1078 type_data = _idl_type_registry.get(type_name) | 1131 type_data = _idl_type_registry.get(type_name) |
| 1079 | 1132 |
| 1080 if type_data.clazz == 'Interface': | 1133 if type_data.clazz == 'Interface': |
| 1081 if self._database.HasInterface(type_name): | 1134 if self._database.HasInterface(type_name): |
| 1082 dart_interface_name = self._renamer.RenameInterface( | 1135 dart_interface_name = self._renamer.RenameInterface( |
| 1083 self._database.GetInterface(type_name)) | 1136 self._database.GetInterface(type_name)) |
| 1084 else: | 1137 else: |
| 1085 dart_interface_name = type_name | 1138 dart_interface_name = type_name |
| 1086 return InterfaceIDLTypeInfo(type_name, type_data, dart_interface_name) | 1139 return InterfaceIDLTypeInfo(type_name, type_data, dart_interface_name, |
| 1140 self) | |
| 1087 | 1141 |
| 1088 if type_data.clazz == 'ListLike': | 1142 if type_data.clazz == 'SVGTearOff': |
| 1089 return ListLikeIDLTypeInfo(type_name, type_data, self.TypeInfo(type_data.i tem_type)) | 1143 return SVGTearOffIDLTypeInfo(type_name, type_data, self) |
| 1090 | 1144 |
| 1091 class_name = '%sIDLTypeInfo' % type_data.clazz | 1145 class_name = '%sIDLTypeInfo' % type_data.clazz |
| 1092 return globals()[class_name](type_name, type_data) | 1146 return globals()[class_name](type_name, type_data) |
| OLD | NEW |