| 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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 ' if (returnValue)\n' | 819 ' if (returnValue)\n' |
| 820 ' Dart_SetReturnValue(args, returnValue);\n', | 820 ' Dart_SetReturnValue(args, returnValue);\n', |
| 821 TO_DART_CONVERSION=to_dart_conversion) | 821 TO_DART_CONVERSION=to_dart_conversion) |
| 822 | 822 |
| 823 def _GenerateNativeBinding(self, idl_name, argument_count, dart_declaration, | 823 def _GenerateNativeBinding(self, idl_name, argument_count, dart_declaration, |
| 824 native_suffix, is_custom, emit_metadata=True): | 824 native_suffix, is_custom, emit_metadata=True): |
| 825 metadata = [] | 825 metadata = [] |
| 826 if emit_metadata: | 826 if emit_metadata: |
| 827 metadata = self._metadata.GetFormattedMetadata( | 827 metadata = self._metadata.GetFormattedMetadata( |
| 828 self._renamer.GetLibraryName(self._interface), | 828 self._renamer.GetLibraryName(self._interface), |
| 829 self._interface.id, idl_name, ' ') | 829 self._interface, idl_name, ' ') |
| 830 | 830 |
| 831 native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix) | 831 native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix) |
| 832 self._members_emitter.Emit( | 832 self._members_emitter.Emit( |
| 833 '\n' | 833 '\n' |
| 834 ' $METADATA$DART_DECLARATION native "$NATIVE_BINDING";\n', | 834 ' $METADATA$DART_DECLARATION native "$NATIVE_BINDING";\n', |
| 835 DOMINTERFACE=self._interface.id, | 835 DOMINTERFACE=self._interface.id, |
| 836 METADATA=metadata, | 836 METADATA=metadata, |
| 837 DART_DECLARATION=dart_declaration, | 837 DART_DECLARATION=dart_declaration, |
| 838 NATIVE_BINDING=native_binding) | 838 NATIVE_BINDING=native_binding) |
| 839 | 839 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' | 947 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' |
| 948 ' return func;\n', | 948 ' return func;\n', |
| 949 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 949 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
| 950 | 950 |
| 951 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): | 951 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): |
| 952 return ( | 952 return ( |
| 953 interface.id.endswith('Event') and | 953 interface.id.endswith('Event') and |
| 954 operation.id.startswith('init') and | 954 operation.id.startswith('init') and |
| 955 argument.ext_attrs.get('Default') == 'Undefined' and | 955 argument.ext_attrs.get('Default') == 'Undefined' and |
| 956 argument.type.id == 'DOMString') | 956 argument.type.id == 'DOMString') |
| OLD | NEW |