| 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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 ' return;\n', | 960 ' return;\n', |
| 961 NATIVE_TYPE=return_type_info.native_type(), | 961 NATIVE_TYPE=return_type_info.native_type(), |
| 962 FUNCTION_CALL=function_call) | 962 FUNCTION_CALL=function_call) |
| 963 value_expression = 'result' | 963 value_expression = 'result' |
| 964 else: | 964 else: |
| 965 value_expression = function_call | 965 value_expression = function_call |
| 966 | 966 |
| 967 # Generate to Dart conversion of C++ value. | 967 # Generate to Dart conversion of C++ value. |
| 968 if return_type_info.dart_type() == 'bool': | 968 if return_type_info.dart_type() == 'bool': |
| 969 set_return_value = 'Dart_SetBooleanReturnValue(args, %s)' % (value_expre
ssion) | 969 set_return_value = 'Dart_SetBooleanReturnValue(args, %s)' % (value_expre
ssion) |
| 970 elif return_type_info.dart_type() == 'int': | 970 elif return_type_info.dart_type() == 'int' and return_type_info.native_typ
e() == 'int': |
| 971 set_return_value = 'Dart_SetIntegerReturnValue(args, %s)' % (value_expre
ssion) | 971 set_return_value = 'Dart_SetIntegerReturnValue(args, %s)' % (value_expre
ssion) |
| 972 elif return_type_info.dart_type() == 'double': | 972 elif return_type_info.dart_type() == 'double': |
| 973 set_return_value = 'Dart_SetDoubleReturnValue(args, %s)' % (value_expres
sion) | 973 set_return_value = 'Dart_SetDoubleReturnValue(args, %s)' % (value_expres
sion) |
| 974 elif return_type_info.dart_type() == 'String': | 974 elif return_type_info.dart_type() == 'String': |
| 975 if ext_attrs and 'TreatReturnedNullStringAs' in ext_attrs: | 975 if ext_attrs and 'TreatReturnedNullStringAs' in ext_attrs: |
| 976 set_return_value = 'DartUtilities::setDartStringReturnValueWithNullChe
ck(args, %s)' % (value_expression) | 976 set_return_value = 'DartUtilities::setDartStringReturnValueWithNullChe
ck(args, %s)' % (value_expression) |
| 977 else: | 977 else: |
| 978 set_return_value = 'DartUtilities::setDartStringReturnValue(args, %s)'
% (value_expression) | 978 set_return_value = 'DartUtilities::setDartStringReturnValue(args, %s)'
% (value_expression) |
| 979 else: | 979 else: |
| 980 to_dart_conversion = return_type_info.to_dart_conversion(value_expressio
n, self._interface.id, ext_attrs) | 980 to_dart_conversion = return_type_info.to_dart_conversion(value_expressio
n, self._interface.id, ext_attrs) |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1116 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' | 1116 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' |
| 1117 ' return func;\n', | 1117 ' return func;\n', |
| 1118 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 1118 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
| 1119 | 1119 |
| 1120 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): | 1120 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): |
| 1121 return ( | 1121 return ( |
| 1122 interface.id.endswith('Event') and | 1122 interface.id.endswith('Event') and |
| 1123 operation.id.startswith('init') and | 1123 operation.id.startswith('init') and |
| 1124 argument.ext_attrs.get('Default') == 'Undefined' and | 1124 argument.ext_attrs.get('Default') == 'Undefined' and |
| 1125 argument.type.id == 'DOMString') | 1125 argument.type.id == 'DOMString') |
| OLD | NEW |