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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 cloned_operation = deepcopy(operation) | 201 cloned_operation = deepcopy(operation) |
202 cloned_operation.ext_attrs['DartName'] = operation_id | 202 cloned_operation.ext_attrs['DartName'] = operation_id |
203 interface.operations.append(cloned_operation) | 203 interface.operations.append(cloned_operation) |
204 | 204 |
205 def _EnsureNoMultipleTypeSignatures(self, interface, operation, | 205 def _EnsureNoMultipleTypeSignatures(self, interface, operation, |
206 operations_by_name): | 206 operations_by_name): |
207 """Make sure that there is now at most one operation with a particular | 207 """Make sure that there is now at most one operation with a particular |
208 operation.id. If not, stop library generation, and throw an error, requiring | 208 operation.id. If not, stop library generation, and throw an error, requiring |
209 programmer input about the best name change before proceeding.""" | 209 programmer input about the best name change before proceeding.""" |
210 operation_str = '%s.%s' % (interface.id, operation.id) | 210 operation_str = '%s.%s' % (interface.id, operation.id) |
| 211 |
211 if (operation.id in operations_by_name and | 212 if (operation.id in operations_by_name and |
212 len(operations_by_name[operation.id]) > 1 and | 213 len(operations_by_name[operation.id]) > 1 and |
213 len(filter(lambda overload: overload.startswith(operation_str), | 214 len(filter(lambda overload: overload.startswith(operation_str), |
214 renamed_overloads.keys())) == 0 and | 215 renamed_overloads.keys())) == 0 and |
215 operation_str not in keep_overloaded_members and | 216 operation_str not in keep_overloaded_members and |
216 operation_str not in overloaded_and_renamed and | 217 operation_str not in overloaded_and_renamed and |
217 operation_str not in renamed_html_members and | 218 operation_str not in renamed_html_members and |
218 operation_str not in private_html_members and | 219 operation_str not in private_html_members and |
219 operation_str not in removed_html_members and | 220 operation_str not in removed_html_members and |
220 operation.id != '__getter__' and | 221 operation.id != '__getter__' and |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 return self._type_registry.TypeInfo(type_name).narrow_dart_type() | 759 return self._type_registry.TypeInfo(type_name).narrow_dart_type() |
759 | 760 |
760 def _NarrowInputType(self, type_name): | 761 def _NarrowInputType(self, type_name): |
761 return self._NarrowToImplementationType(type_name) | 762 return self._NarrowToImplementationType(type_name) |
762 | 763 |
763 def _DartType(self, type_name): | 764 def _DartType(self, type_name): |
764 return self._type_registry.DartType(type_name) | 765 return self._type_registry.DartType(type_name) |
765 | 766 |
766 def _TypeInfo(self, type_name): | 767 def _TypeInfo(self, type_name): |
767 return self._type_registry.TypeInfo(type_name) | 768 return self._type_registry.TypeInfo(type_name) |
OLD | NEW |