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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 self.DeriveNativeEntry("constructorCallback", 'Constructor', arg
ument_count) | 619 self.DeriveNativeEntry("constructorCallback", 'Constructor', arg
ument_count) |
620 qualified_name = \ | 620 qualified_name = \ |
621 self.DeriveQualifiedBlinkName(self._interface.id, | 621 self.DeriveQualifiedBlinkName(self._interface.id, |
622 base_name) | 622 base_name) |
623 args = constructor_info.ParametersAsArgumentList(argument_count) | 623 args = constructor_info.ParametersAsArgumentList(argument_count) |
624 | 624 |
625 # Handle converting Maps to Dictionaries, etc. | 625 # Handle converting Maps to Dictionaries, etc. |
626 (factory_params, converted_arguments) = self._ConvertArgumentTypes( | 626 (factory_params, converted_arguments) = self._ConvertArgumentTypes( |
627 stmts_emitter, arguments, argument_count, constructor_info) | 627 stmts_emitter, arguments, argument_count, constructor_info) |
628 args = ', '.join(converted_arguments) | 628 args = ', '.join(converted_arguments) |
629 call_template = 'wrap_jso($FACTORY_NAME($FACTORY_PARAMS))' | 629 call_template = '$FACTORY_NAME($FACTORY_PARAMS)' |
630 else: | 630 else: |
631 qualified_name = emitter.Format( | 631 qualified_name = emitter.Format( |
632 '$FACTORY.$NAME', | 632 '$FACTORY.$NAME', |
633 FACTORY=factory_name, | 633 FACTORY=factory_name, |
634 NAME=name) | 634 NAME=name) |
635 (factory_params, converted_arguments) = self._ConvertArgumentTypes( | 635 (factory_params, converted_arguments) = self._ConvertArgumentTypes( |
636 stmts_emitter, arguments, argument_count, constructor_info) | 636 stmts_emitter, arguments, argument_count, constructor_info) |
637 args = ', '.join(converted_arguments) | 637 args = ', '.join(converted_arguments) |
638 call_template = '$FACTORY_NAME($FACTORY_PARAMS)' | 638 call_template = '$FACTORY_NAME($FACTORY_PARAMS)' |
639 call_emitter.Emit(call_template, FACTORY_NAME=qualified_name, FACTORY_PA
RAMS=args) | 639 call_emitter.Emit(call_template, FACTORY_NAME=qualified_name, FACTORY_PA
RAMS=args) |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 def _InputType(self, type_name, info): | 888 def _InputType(self, type_name, info): |
889 conversion = self._InputConversion(type_name, info.declared_name) | 889 conversion = self._InputConversion(type_name, info.declared_name) |
890 if conversion: | 890 if conversion: |
891 return conversion.input_type | 891 return conversion.input_type |
892 else: | 892 else: |
893 # If typedef it's a union return dynamic. | 893 # If typedef it's a union return dynamic. |
894 if self._database.HasTypeDef(type_name): | 894 if self._database.HasTypeDef(type_name): |
895 return 'dynamic' | 895 return 'dynamic' |
896 else: | 896 else: |
897 return self._NarrowInputType(type_name) if type_name else 'dynamic' | 897 return self._NarrowInputType(type_name) if type_name else 'dynamic' |
OLD | NEW |