| 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 system to generate | 6 """This module provides shared functionality for the system to generate |
| 7 dart:html APIs from the IDL database.""" | 7 dart:html APIs from the IDL database.""" |
| 8 | 8 |
| 9 import emitter | 9 import emitter |
| 10 from generator import AnalyzeOperation, ConstantOutputOrder, \ | 10 from generator import AnalyzeOperation, ConstantOutputOrder, \ |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 is_optional, | 468 is_optional, |
| 469 can_omit_type_check=lambda type, pos: False): | 469 can_omit_type_check=lambda type, pos: False): |
| 470 | 470 |
| 471 def GenerateCall( | 471 def GenerateCall( |
| 472 stmts_emitter, call_emitter, version, signature_index, argument_count): | 472 stmts_emitter, call_emitter, version, signature_index, argument_count): |
| 473 generate_call( | 473 generate_call( |
| 474 stmts_emitter, call_emitter, | 474 stmts_emitter, call_emitter, |
| 475 version, operations[signature_index], argument_count) | 475 version, operations[signature_index], argument_count) |
| 476 | 476 |
| 477 def IsOptional(signature_index, argument): | 477 def IsOptional(signature_index, argument): |
| 478 return is_optional(operations[signature_index], argument) | 478 return is_optional(argument) |
| 479 | 479 |
| 480 emitter = self._members_emitter | 480 emitter = self._members_emitter |
| 481 | 481 |
| 482 self._GenerateOverloadDispatcher( | 482 self._GenerateOverloadDispatcher( |
| 483 info, | 483 info, |
| 484 [operation.arguments for operation in operations], | 484 [operation.arguments for operation in operations], |
| 485 operations[0].type.id == 'void', | 485 operations[0].type.id == 'void', |
| 486 declaration, | 486 declaration, |
| 487 GenerateCall, | 487 GenerateCall, |
| 488 IsOptional, | 488 IsOptional, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 self._DartType) | 582 self._DartType) |
| 583 | 583 |
| 584 def GenerateCall( | 584 def GenerateCall( |
| 585 stmts_emitter, call_emitter, | 585 stmts_emitter, call_emitter, |
| 586 version, signature_index, argument_count): | 586 version, signature_index, argument_count): |
| 587 name = emitter.Format('_create_$VERSION', VERSION=version) | 587 name = emitter.Format('_create_$VERSION', VERSION=version) |
| 588 arguments = constructor_info.idl_args[signature_index][:argument_count] | 588 arguments = constructor_info.idl_args[signature_index][:argument_count] |
| 589 if self._dart_use_blink: | 589 if self._dart_use_blink: |
| 590 type_ids = [p.type.id for p in arguments] | 590 type_ids = [p.type.id for p in arguments] |
| 591 base_name, rs = \ | 591 base_name, rs = \ |
| 592 self.DeriveNativeEntry("constructorCallback", None, type_ids, | 592 self.DeriveNativeEntry("constructorCallback", 'Constructor', arg
ument_count) |
| 593 False) | |
| 594 qualified_name = \ | 593 qualified_name = \ |
| 595 self.DeriveQualifiedBlinkName(self._interface.id, | 594 self.DeriveQualifiedBlinkName(self._interface.id, |
| 596 base_name) | 595 base_name) |
| 597 else: | 596 else: |
| 598 qualified_name = emitter.Format( | 597 qualified_name = emitter.Format( |
| 599 '$FACTORY.$NAME', | 598 '$FACTORY.$NAME', |
| 600 FACTORY=factory_name, | 599 FACTORY=factory_name, |
| 601 NAME=name) | 600 NAME=name) |
| 602 call_emitter.Emit('$FACTORY_NAME($FACTORY_PARAMS)', | 601 call_emitter.Emit('$FACTORY_NAME($FACTORY_PARAMS)', |
| 603 FACTORY_NAME=qualified_name, | 602 FACTORY_NAME=qualified_name, |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 return self._type_registry.TypeInfo(type_name).narrow_dart_type() | 778 return self._type_registry.TypeInfo(type_name).narrow_dart_type() |
| 780 | 779 |
| 781 def _NarrowInputType(self, type_name): | 780 def _NarrowInputType(self, type_name): |
| 782 return self._NarrowToImplementationType(type_name) | 781 return self._NarrowToImplementationType(type_name) |
| 783 | 782 |
| 784 def _DartType(self, type_name): | 783 def _DartType(self, type_name): |
| 785 return self._type_registry.DartType(type_name) | 784 return self._type_registry.DartType(type_name) |
| 786 | 785 |
| 787 def _TypeInfo(self, type_name): | 786 def _TypeInfo(self, type_name): |
| 788 return self._type_registry.TypeInfo(type_name) | 787 return self._type_registry.TypeInfo(type_name) |
| OLD | NEW |