| 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 self._cpp_resolver_emitter.Emit( | 248 self._cpp_resolver_emitter.Emit( |
| 249 ' if (name == "$(INTERFACE_NAME)_constructor_Callback")\n' | 249 ' if (name == "$(INTERFACE_NAME)_constructor_Callback")\n' |
| 250 ' return Dart$(INTERFACE_NAME)Internal::constructorCallback;\n', | 250 ' return Dart$(INTERFACE_NAME)Internal::constructorCallback;\n', |
| 251 INTERFACE_NAME=self._interface.id) | 251 INTERFACE_NAME=self._interface.id) |
| 252 | 252 |
| 253 | 253 |
| 254 constructor_info = AnalyzeConstructor(self._interface) | 254 constructor_info = AnalyzeConstructor(self._interface) |
| 255 if constructor_info: | 255 if constructor_info: |
| 256 self._EmitFactoryProvider(self._interface.id, constructor_info) | 256 self._EmitFactoryProvider(self._interface.id, constructor_info) |
| 257 | 257 |
| 258 if constructor_info is None: | 258 if 'CustomConstructor' in self._interface.ext_attrs: |
| 259 # We have a custom implementation for it. | 259 # We have a custom implementation for it. |
| 260 self._cpp_declarations_emitter.Emit( | 260 self._cpp_declarations_emitter.Emit( |
| 261 '\n' | 261 '\n' |
| 262 'void constructorCallback(Dart_NativeArguments);\n') | 262 'void constructorCallback(Dart_NativeArguments);\n') |
| 263 return | 263 return |
| 264 | 264 |
| 265 raises_dom_exceptions = 'ConstructorRaisesException' in self._interface.ext_
attrs | 265 raises_dom_exceptions = 'ConstructorRaisesException' in self._interface.ext_
attrs |
| 266 raises_exceptions = raises_dom_exceptions or len(constructor_info.idl_args)
> 0 | 266 raises_exceptions = raises_dom_exceptions or len(constructor_info.idl_args)
> 0 |
| 267 arguments = [] | 267 arguments = [] |
| 268 parameter_definitions_emitter = emitter.Emitter() | 268 parameter_definitions_emitter = emitter.Emitter() |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 continue | 1050 continue |
| 1051 parent_interface = database.GetInterface(parent.type.id) | 1051 parent_interface = database.GetInterface(parent.type.id) |
| 1052 if callback(parent_interface): | 1052 if callback(parent_interface): |
| 1053 return parent_interface | 1053 return parent_interface |
| 1054 parent_interface = _FindParent(parent_interface, database, callback) | 1054 parent_interface = _FindParent(parent_interface, database, callback) |
| 1055 if parent_interface: | 1055 if parent_interface: |
| 1056 return parent_interface | 1056 return parent_interface |
| 1057 | 1057 |
| 1058 def _IsArgumentOptionalInWebCore(argument): | 1058 def _IsArgumentOptionalInWebCore(argument): |
| 1059 return IsOptional(argument) and not 'Callback' in argument.ext_attrs | 1059 return IsOptional(argument) and not 'Callback' in argument.ext_attrs |
| OLD | NEW |