| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 INTERFACE_NAME=self._interface.id); | 199 INTERFACE_NAME=self._interface.id); |
| 200 | 200 |
| 201 def _EmitConstructorInfrastructure(self, | 201 def _EmitConstructorInfrastructure(self, |
| 202 constructor_info, constructor_callback_cpp_name, factory_method_name, | 202 constructor_info, constructor_callback_cpp_name, factory_method_name, |
| 203 argument_count=None): | 203 argument_count=None): |
| 204 constructor_callback_id = self._interface.id + '_' + constructor_callback_cp
p_name | 204 constructor_callback_id = self._interface.id + '_' + constructor_callback_cp
p_name |
| 205 if argument_count is None: | 205 if argument_count is None: |
| 206 argument_count = len(constructor_info.param_infos) | 206 argument_count = len(constructor_info.param_infos) |
| 207 | 207 |
| 208 self._members_emitter.Emit( | 208 self._members_emitter.Emit( |
| 209 '\n @DocsEditable\n' | 209 '\n @DocsEditable()\n' |
| 210 ' static $INTERFACE_NAME $FACTORY_METHOD_NAME($PARAMETERS) ' | 210 ' static $INTERFACE_NAME $FACTORY_METHOD_NAME($PARAMETERS) ' |
| 211 'native "$ID";\n', | 211 'native "$ID";\n', |
| 212 INTERFACE_NAME=self._interface_type_info.interface_name(), | 212 INTERFACE_NAME=self._interface_type_info.interface_name(), |
| 213 FACTORY_METHOD_NAME=factory_method_name, | 213 FACTORY_METHOD_NAME=factory_method_name, |
| 214 # TODO: add types to parameters. | 214 # TODO: add types to parameters. |
| 215 PARAMETERS=constructor_info.ParametersAsArgumentList(argument_count), | 215 PARAMETERS=constructor_info.ParametersAsArgumentList(argument_count), |
| 216 ID=constructor_callback_id) | 216 ID=constructor_callback_id) |
| 217 | 217 |
| 218 self._cpp_resolver_emitter.Emit( | 218 self._cpp_resolver_emitter.Emit( |
| 219 ' if (name == "$ID")\n' | 219 ' if (name == "$ID")\n' |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' | 1013 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' |
| 1014 ' return func;\n', | 1014 ' return func;\n', |
| 1015 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 1015 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
| 1016 | 1016 |
| 1017 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): | 1017 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): |
| 1018 return ( | 1018 return ( |
| 1019 interface.id.endswith('Event') and | 1019 interface.id.endswith('Event') and |
| 1020 operation.id.startswith('init') and | 1020 operation.id.startswith('init') and |
| 1021 argument.ext_attrs.get('Default') == 'Undefined' and | 1021 argument.ext_attrs.get('Default') == 'Undefined' and |
| 1022 argument.type.id == 'DOMString') | 1022 argument.type.id == 'DOMString') |
| OLD | NEW |