| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 few specific instances.""" | 159 few specific instances.""" |
| 160 potential_added_operations = set() | 160 potential_added_operations = set() |
| 161 operations_by_name = self._OperationsByName(interface) | 161 operations_by_name = self._OperationsByName(interface) |
| 162 already_renamed = [operation.ext_attrs['DartName'] if 'DartName' in | 162 already_renamed = [operation.ext_attrs['DartName'] if 'DartName' in |
| 163 operation.ext_attrs else '' for operation in interface.operations] | 163 operation.ext_attrs else '' for operation in interface.operations] |
| 164 | 164 |
| 165 for operation in interface.operations: | 165 for operation in interface.operations: |
| 166 full_operation_str = self._GetStringRepresentation(interface, operation) | 166 full_operation_str = self._GetStringRepresentation(interface, operation) |
| 167 if (full_operation_str in renamed_overloads and | 167 if (full_operation_str in renamed_overloads and |
| 168 renamed_overloads[full_operation_str] not in already_renamed): | 168 renamed_overloads[full_operation_str] not in already_renamed): |
| 169 operation.ext_attrs['DartName'] = renamed_overloads[ | 169 dart_name = renamed_overloads[full_operation_str] |
| 170 full_operation_str] | 170 if not dart_name: |
| 171 continue |
| 172 |
| 173 operation.ext_attrs['DartName'] = dart_name |
| 171 potential_added_operations.add(operation.id) | 174 potential_added_operations.add(operation.id) |
| 172 self._EnsureNoMultipleTypeSignatures(interface, operation, | 175 self._EnsureNoMultipleTypeSignatures(interface, operation, |
| 173 operations_by_name) | 176 operations_by_name) |
| 174 self._AddDesiredOverloadedOperations(potential_added_operations, interface, | 177 self._AddDesiredOverloadedOperations(potential_added_operations, interface, |
| 175 operations_by_name) | 178 operations_by_name) |
| 176 | 179 |
| 177 def _AddDesiredOverloadedOperations(self, potential_added_operations, | 180 def _AddDesiredOverloadedOperations(self, potential_added_operations, |
| 178 interface, original_operations_by_name): | 181 interface, original_operations_by_name): |
| 179 """For some cases we desire to keep the overloaded version in dart, for | 182 """For some cases we desire to keep the overloaded version in dart, for |
| 180 simplicity of API, and explain the parameters accepted in documentation.""" | 183 simplicity of API, and explain the parameters accepted in documentation.""" |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 | 694 |
| 692 def SecureBaseName(self, type_name): | 695 def SecureBaseName(self, type_name): |
| 693 if type_name in _secure_base_types: | 696 if type_name in _secure_base_types: |
| 694 return _secure_base_types[type_name] | 697 return _secure_base_types[type_name] |
| 695 | 698 |
| 696 def _DartType(self, type_name): | 699 def _DartType(self, type_name): |
| 697 return self._type_registry.DartType(type_name) | 700 return self._type_registry.DartType(type_name) |
| 698 | 701 |
| 699 def _TypeInfo(self, type_name): | 702 def _TypeInfo(self, type_name): |
| 700 return self._type_registry.TypeInfo(type_name) | 703 return self._type_registry.TypeInfo(type_name) |
| OLD | NEW |