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 the systems to generate | 6 """This module provides shared functionality for the systems to generate |
7 native binding from the IDL database.""" | 7 native binding from the IDL database.""" |
8 | 8 |
9 import emitter | 9 import emitter |
10 import os | 10 import os |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
668 # and | 668 # and |
669 # | 669 # |
670 # class YImpl extends ListBase<T> { copies of transitive XImpl methods; } | 670 # class YImpl extends ListBase<T> { copies of transitive XImpl methods; } |
671 # | 671 # |
672 dart_element_type = self._DartType(element_type) | 672 dart_element_type = self._DartType(element_type) |
673 if self._HasNativeIndexGetter(): | 673 if self._HasNativeIndexGetter(): |
674 self._EmitNativeIndexGetter(dart_element_type) | 674 self._EmitNativeIndexGetter(dart_element_type) |
675 else: | 675 else: |
676 self._members_emitter.Emit( | 676 self._members_emitter.Emit( |
677 '\n' | 677 '\n' |
678 ' $TYPE operator[](int index) {\n' | 678 ' $TYPE operator[](int index) native "$(INTERFACE)_item_Callback";\n' , |
679 ' return item(index);\n' | 679 TYPE=dart_element_type, INTERFACE=self._interface.id) |
680 ' }\n', | |
681 TYPE=dart_element_type) | |
682 | 680 |
683 if self._HasNativeIndexSetter(): | 681 if self._HasNativeIndexSetter(): |
684 self._EmitNativeIndexSetter(dart_element_type) | 682 self._EmitNativeIndexSetter(dart_element_type) |
685 else: | 683 else: |
686 # The HTML library implementation of NodeList has a custom indexed setter | 684 # The HTML library implementation of NodeList has a custom indexed setter |
687 # implementation that uses the parent node the NodeList is associated | 685 # implementation that uses the parent node the NodeList is associated |
688 # with if one is available. | 686 # with if one is available. |
689 if self._interface.id != 'NodeList': | 687 if self._interface.id != 'NodeList': |
690 self._members_emitter.Emit( | 688 self._members_emitter.Emit( |
691 '\n' | 689 '\n' |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
748 if 'CheckSecurityForNode' in operation.ext_attrs: | 746 if 'CheckSecurityForNode' in operation.ext_attrs: |
749 # FIXME: exclude from interface as well. | 747 # FIXME: exclude from interface as well. |
750 return | 748 return |
751 | 749 |
752 html_interface_name = self._HTMLInterfaceName(self._interface.id) | 750 html_interface_name = self._HTMLInterfaceName(self._interface.id) |
753 html_name = self._html_system.RenameInHtmlLibrary( | 751 html_name = self._html_system.RenameInHtmlLibrary( |
754 html_interface_name, info.name, implementation_class=True) | 752 html_interface_name, info.name, implementation_class=True) |
755 | 753 |
756 if not html_name and info.name == 'item': | 754 if not html_name and info.name == 'item': |
757 # FIXME: item should be renamed to operator[], not removed. | 755 # FIXME: item should be renamed to operator[], not removed. |
758 html_name = 'item' | 756 html_name = '_item' |
Anton Muhin
2012/06/05 16:38:51
do we need it still?
podivilov
2012/06/05 16:45:25
Yes, we still need to generate native implementati
Anton Muhin
2012/06/05 16:49:19
Ok, thanks.
On 2012/06/05 16:45:25, podivilov wrot
| |
759 | 757 |
760 if not html_name: | 758 if not html_name: |
761 return | 759 return |
762 | 760 |
763 dart_declaration = '%s%s %s(%s)' % ( | 761 dart_declaration = '%s%s %s(%s)' % ( |
764 'static ' if info.IsStatic() else '', | 762 'static ' if info.IsStatic() else '', |
765 self._DartType(info.type_name), | 763 self._DartType(info.type_name), |
766 html_name, | 764 html_name, |
767 info.ParametersImplementationDeclaration(self._DartType)) | 765 info.ParametersImplementationDeclaration(self._DartType)) |
768 | 766 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1047 for parent in interface.parents: | 1045 for parent in interface.parents: |
1048 parent_name = parent.type.id | 1046 parent_name = parent.type.id |
1049 if not database.HasInterface(parent.type.id): | 1047 if not database.HasInterface(parent.type.id): |
1050 continue | 1048 continue |
1051 parent_interface = database.GetInterface(parent.type.id) | 1049 parent_interface = database.GetInterface(parent.type.id) |
1052 if callback(parent_interface): | 1050 if callback(parent_interface): |
1053 return parent_interface | 1051 return parent_interface |
1054 parent_interface = _FindParent(parent_interface, database, callback) | 1052 parent_interface = _FindParent(parent_interface, database, callback) |
1055 if parent_interface: | 1053 if parent_interface: |
1056 return parent_interface | 1054 return parent_interface |
OLD | NEW |