| 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 ' {\n' | 389 ' {\n' |
| 390 ' return DartDOMWrapper::unwrapDartWrapper<Dart$INTERFACE>(hand
le, exception);\n' | 390 ' return DartDOMWrapper::unwrapDartWrapper<Dart$INTERFACE>(hand
le, exception);\n' |
| 391 ' }\n') | 391 ' }\n') |
| 392 | 392 |
| 393 if ('CustomToJS' in self._interface.ext_attrs or | 393 if ('CustomToJS' in self._interface.ext_attrs or |
| 394 'CustomToJSObject' in self._interface.ext_attrs or | 394 'CustomToJSObject' in self._interface.ext_attrs or |
| 395 'PureInterface' in self._interface.ext_attrs or | 395 'PureInterface' in self._interface.ext_attrs or |
| 396 'CPPPureInterface' in self._interface.ext_attrs or | 396 'CPPPureInterface' in self._interface.ext_attrs or |
| 397 self._interface_type_info.custom_to_dart()): | 397 self._interface_type_info.custom_to_dart()): |
| 398 to_dart_template = ( | 398 to_dart_template = ( |
| 399 'Dart_Handle toDartValue($(WEBCORE_CLASS_NAME)* value);\n') | 399 ' static Dart_Handle toDart($(WEBCORE_CLASS_NAME)* value);\n') |
| 400 else: | 400 else: |
| 401 to_dart_template = ( | 401 to_dart_template = ( |
| 402 'inline Dart_Handle toDartValue($(WEBCORE_CLASS_NAME)* value)\n' | 402 ' static Dart_Handle toDart($(WEBCORE_CLASS_NAME)* value)\n' |
| 403 '{\n' | 403 ' {\n' |
| 404 ' return DartDOMWrapper::toDart<Dart$(INTERFACE)>(value);\n' | 404 ' return DartDOMWrapper::toDart<Dart$(INTERFACE)>(value);\n' |
| 405 '}\n') | 405 ' }\n') |
| 406 | 406 |
| 407 intermediate_emitter = emitter.Emitter() | 407 intermediate_emitter = emitter.Emitter() |
| 408 intermediate_emitter.Emit( | 408 intermediate_emitter.Emit( |
| 409 self._templates.Load('cpp_header.template'), | 409 self._templates.Load('cpp_header.template'), |
| 410 TO_NATIVE=to_native_template, | 410 TO_NATIVE=to_native_template, |
| 411 TO_DART=to_dart_template) | 411 TO_DART=to_dart_template) |
| 412 | 412 |
| 413 webcore_includes = _GenerateCPPIncludes(self._interface_type_info.webcore_in
cludes()) | 413 webcore_includes = _GenerateCPPIncludes(self._interface_type_info.webcore_in
cludes()) |
| 414 wrapper_type = _DOMWrapperType(self._system._database, self._interface) | 414 wrapper_type = _DOMWrapperType(self._system._database, self._interface) |
| 415 self._cpp_header_emitter.Emit( | 415 self._cpp_header_emitter.Emit( |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 def _InstanceOfNode(database, interface): | 846 def _InstanceOfNode(database, interface): |
| 847 if interface.id == 'Node': | 847 if interface.id == 'Node': |
| 848 return True | 848 return True |
| 849 for parent in interface.parents: | 849 for parent in interface.parents: |
| 850 if not database.HasInterface(parent.type.id): | 850 if not database.HasInterface(parent.type.id): |
| 851 continue | 851 continue |
| 852 parent_interface = database.GetInterface(parent.type.id) | 852 parent_interface = database.GetInterface(parent.type.id) |
| 853 if _InstanceOfNode(database, parent_interface): | 853 if _InstanceOfNode(database, parent_interface): |
| 854 return True | 854 return True |
| 855 return False | 855 return False |
| OLD | NEW |