| 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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 to_dart_conversion = return_type_info.to_dart_conversion(function_call, se
lf._interface.id, ext_attrs) | 756 to_dart_conversion = return_type_info.to_dart_conversion(function_call, se
lf._interface.id, ext_attrs) |
| 757 invocation_emitter.Emit( | 757 invocation_emitter.Emit( |
| 758 ' Dart_Handle returnValue = $TO_DART_CONVERSION;\n' | 758 ' Dart_Handle returnValue = $TO_DART_CONVERSION;\n' |
| 759 ' if (returnValue)\n' | 759 ' if (returnValue)\n' |
| 760 ' Dart_SetReturnValue(args, returnValue);\n', | 760 ' Dart_SetReturnValue(args, returnValue);\n', |
| 761 TO_DART_CONVERSION=to_dart_conversion) | 761 TO_DART_CONVERSION=to_dart_conversion) |
| 762 | 762 |
| 763 def _GenerateNativeBinding(self, idl_name, argument_count, dart_declaration, | 763 def _GenerateNativeBinding(self, idl_name, argument_count, dart_declaration, |
| 764 native_suffix, is_custom): | 764 native_suffix, is_custom): |
| 765 annotations = FormatAnnotationsAndComments( | 765 annotations = FormatAnnotationsAndComments( |
| 766 GetAnnotationsAndComments(self._interface.id, idl_name, | 766 GetAnnotationsAndComments(self._renamer.GetLibraryName(self._interface), |
| 767 self._renamer.GetLibraryName( | 767 self._interface.id, idl_name), |
| 768 self._interface)), | |
| 769 ' ') | 768 ' ') |
| 770 | 769 |
| 771 native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix) | 770 native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix) |
| 772 self._members_emitter.Emit( | 771 self._members_emitter.Emit( |
| 773 '\n' | 772 '\n' |
| 774 ' $ANNOTATIONS$DART_DECLARATION native "$NATIVE_BINDING";\n', | 773 ' $ANNOTATIONS$DART_DECLARATION native "$NATIVE_BINDING";\n', |
| 775 DOMINTERFACE=self._interface.id, | 774 DOMINTERFACE=self._interface.id, |
| 776 ANNOTATIONS=annotations, | 775 ANNOTATIONS=annotations, |
| 777 DART_DECLARATION=dart_declaration, | 776 DART_DECLARATION=dart_declaration, |
| 778 NATIVE_BINDING=native_binding) | 777 NATIVE_BINDING=native_binding) |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' | 890 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' |
| 892 ' return func;\n', | 891 ' return func;\n', |
| 893 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 892 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
| 894 | 893 |
| 895 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): | 894 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): |
| 896 return ( | 895 return ( |
| 897 interface.id.endswith('Event') and | 896 interface.id.endswith('Event') and |
| 898 operation.id.startswith('init') and | 897 operation.id.startswith('init') and |
| 899 argument.ext_attrs.get('Optional') == 'DefaultIsUndefined' and | 898 argument.ext_attrs.get('Optional') == 'DefaultIsUndefined' and |
| 900 argument.type.id == 'DOMString') | 899 argument.type.id == 'DOMString') |
| OLD | NEW |