| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 ' if (name == "$ID")\n' | 234 ' if (name == "$ID")\n' |
| 235 ' return Dart$(WEBKIT_INTERFACE_NAME)Internal::$CPP_CALLBACK;\n', | 235 ' return Dart$(WEBKIT_INTERFACE_NAME)Internal::$CPP_CALLBACK;\n', |
| 236 ID=constructor_callback_id, | 236 ID=constructor_callback_id, |
| 237 WEBKIT_INTERFACE_NAME=self._interface.id, | 237 WEBKIT_INTERFACE_NAME=self._interface.id, |
| 238 CPP_CALLBACK=constructor_callback_cpp_name) | 238 CPP_CALLBACK=constructor_callback_cpp_name) |
| 239 | 239 |
| 240 def GenerateCustomFactory(self, constructor_info): | 240 def GenerateCustomFactory(self, constructor_info): |
| 241 if 'CustomConstructor' not in self._interface.ext_attrs: | 241 if 'CustomConstructor' not in self._interface.ext_attrs: |
| 242 return False | 242 return False |
| 243 | 243 |
| 244 annotations = self._metadata.GetFormattedMetadata(self._library_name, |
| 245 self._interface, self._interface.id, ' ') |
| 246 |
| 244 self._members_emitter.Emit( | 247 self._members_emitter.Emit( |
| 245 ' factory $CTOR($PARAMS) => _create($FACTORY_PARAMS);\n', | 248 '\n $(ANNOTATIONS)factory $CTOR($PARAMS) => _create($FACTORY_PARAMS);\n
', |
| 249 ANNOTATIONS=annotations, |
| 246 CTOR=constructor_info._ConstructorFullName(self._DartType), | 250 CTOR=constructor_info._ConstructorFullName(self._DartType), |
| 247 PARAMS=constructor_info.ParametersDeclaration(self._DartType), | 251 PARAMS=constructor_info.ParametersDeclaration(self._DartType), |
| 248 FACTORY_PARAMS= \ | 252 FACTORY_PARAMS= \ |
| 249 constructor_info.ParametersAsArgumentList()) | 253 constructor_info.ParametersAsArgumentList()) |
| 250 | 254 |
| 251 constructor_callback_cpp_name = 'constructorCallback' | 255 constructor_callback_cpp_name = 'constructorCallback' |
| 252 self._EmitConstructorInfrastructure( | 256 self._EmitConstructorInfrastructure( |
| 253 constructor_info, constructor_callback_cpp_name, '_create') | 257 constructor_info, constructor_callback_cpp_name, '_create') |
| 254 | 258 |
| 255 self._cpp_declarations_emitter.Emit( | 259 self._cpp_declarations_emitter.Emit( |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' | 1020 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' |
| 1017 ' return func;\n', | 1021 ' return func;\n', |
| 1018 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 1022 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
| 1019 | 1023 |
| 1020 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): | 1024 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): |
| 1021 return ( | 1025 return ( |
| 1022 interface.id.endswith('Event') and | 1026 interface.id.endswith('Event') and |
| 1023 operation.id.startswith('init') and | 1027 operation.id.startswith('init') and |
| 1024 argument.ext_attrs.get('Default') == 'Undefined' and | 1028 argument.ext_attrs.get('Default') == 'Undefined' and |
| 1025 argument.type.id == 'DOMString') | 1029 argument.type.id == 'DOMString') |
| OLD | NEW |