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