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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 CTOR=constructor_info._ConstructorFullName(self._DartType), | 580 CTOR=constructor_info._ConstructorFullName(self._DartType), |
581 PARAMS=constructor_info.ParametersAsDeclaration(InputType), | 581 PARAMS=constructor_info.ParametersAsDeclaration(InputType), |
582 FACTORY=factory_name, | 582 FACTORY=factory_name, |
583 METADATA=metadata, | 583 METADATA=metadata, |
584 CTOR_FACTORY_NAME=factory_constructor_name, | 584 CTOR_FACTORY_NAME=factory_constructor_name, |
585 FACTORY_PARAMS=factory_parameters) | 585 FACTORY_PARAMS=factory_parameters) |
586 else: | 586 else: |
587 inits = self._members_emitter.Emit( | 587 inits = self._members_emitter.Emit( |
588 '\n $(METADATA)' | 588 '\n $(METADATA)' |
589 'factory $CONSTRUCTOR($PARAMS) {\n' | 589 'factory $CONSTRUCTOR($PARAMS) {\n' |
590 ' var e = $FACTORY.$CTOR_FACTORY_NAME($FACTORY_PARAMS);\n' | 590 ' $CONSTRUCTOR e = $FACTORY.$CTOR_FACTORY_NAME($FACTORY_PARAMS);\
n' |
591 '$!INITS' | 591 '$!INITS' |
592 ' return e;\n' | 592 ' return e;\n' |
593 ' }\n', | 593 ' }\n', |
594 CONSTRUCTOR=constructor_info._ConstructorFullName(self._DartType), | 594 CONSTRUCTOR=constructor_info._ConstructorFullName(self._DartType), |
595 METADATA=metadata, | 595 METADATA=metadata, |
596 FACTORY=factory_name, | 596 FACTORY=factory_name, |
597 CTOR_FACTORY_NAME=factory_constructor_name, | 597 CTOR_FACTORY_NAME=factory_constructor_name, |
598 PARAMS=constructor_info.ParametersAsDeclaration(InputType), | 598 PARAMS=constructor_info.ParametersAsDeclaration(InputType), |
599 FACTORY_PARAMS=factory_parameters) | 599 FACTORY_PARAMS=factory_parameters) |
600 | 600 |
(...skipping 287 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 |