| 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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 '}\n', | 558 '}\n', |
| 559 INTERFACE_NAME=self._interface.id); | 559 INTERFACE_NAME=self._interface.id); |
| 560 | 560 |
| 561 def _EmitConstructorInfrastructure(self, | 561 def _EmitConstructorInfrastructure(self, |
| 562 constructor_info, cpp_prefix, cpp_suffix, factory_method_name, | 562 constructor_info, cpp_prefix, cpp_suffix, factory_method_name, |
| 563 arguments=None, emit_to_native=False): | 563 arguments=None, emit_to_native=False): |
| 564 | 564 |
| 565 constructor_callback_cpp_name = cpp_prefix + cpp_suffix | 565 constructor_callback_cpp_name = cpp_prefix + cpp_suffix |
| 566 | 566 |
| 567 if arguments is None: | 567 if arguments is None: |
| 568 argument_count = len(constructor_info.param_infos) | 568 if self._dart_use_blink: |
| 569 arguments = constructor_info.idl_args[0] |
| 570 argument_count = len(arguments) |
| 571 else: |
| 572 argument_count = len(constructor_info.param_infos) |
| 569 else: | 573 else: |
| 570 argument_count = len(arguments) | 574 argument_count = len(arguments) |
| 571 | 575 |
| 572 typed_formals = constructor_info.ParametersAsArgumentList(argument_count) | 576 typed_formals = constructor_info.ParametersAsArgumentList(argument_count) |
| 573 parameters = constructor_info.ParametersAsStringOfVariables(argument_count) | 577 parameters = constructor_info.ParametersAsStringOfVariables(argument_count) |
| 574 interface_name = self._interface_type_info.interface_name() | 578 interface_name = self._interface_type_info.interface_name() |
| 575 | 579 |
| 576 if self._dart_use_blink and arguments: | 580 if self._dart_use_blink: |
| 577 type_ids = [p.type.id for p in arguments] | 581 type_ids = [p.type.id for p in arguments] |
| 578 constructor_callback_id = \ | 582 constructor_callback_id = \ |
| 579 DeriveResolverString(self._interface.id, | 583 DeriveResolverString(self._interface.id, |
| 580 cpp_suffix, None, | 584 cpp_suffix, None, |
| 581 argument_count, type_ids) | 585 argument_count, type_ids) |
| 582 else: | 586 else: |
| 583 constructor_callback_id = self._interface.id + '_' + constructor_callbac
k_cpp_name | 587 constructor_callback_id = self._interface.id + '_' + constructor_callbac
k_cpp_name |
| 584 | 588 |
| 585 if self._dart_use_blink: | 589 if self._dart_use_blink: |
| 586 # First we emit the toplevel function | 590 # First we emit the toplevel function |
| (...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1934 e.Emit("};\n"); | 1938 e.Emit("};\n"); |
| 1935 e.Emit('\n'); | 1939 e.Emit('\n'); |
| 1936 e.Emit('} // namespace WebCore\n'); | 1940 e.Emit('} // namespace WebCore\n'); |
| 1937 | 1941 |
| 1938 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): | 1942 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): |
| 1939 return ( | 1943 return ( |
| 1940 interface.id.endswith('Event') and | 1944 interface.id.endswith('Event') and |
| 1941 operation.id.startswith('init') and | 1945 operation.id.startswith('init') and |
| 1942 argument.ext_attrs.get('Default') == 'Undefined' and | 1946 argument.ext_attrs.get('Default') == 'Undefined' and |
| 1943 argument.type.id == 'DOMString') | 1947 argument.type.id == 'DOMString') |
| OLD | NEW |