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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 # defined in the current interface as well as a parent. In that case we | 125 # defined in the current interface as well as a parent. In that case we |
126 # avoid making a duplicate definition and pray that the signatures match. | 126 # avoid making a duplicate definition and pray that the signatures match. |
127 if not self._renamer.ShouldSuppressInterface(interface): | 127 if not self._renamer.ShouldSuppressInterface(interface): |
128 secondary_constants = sorted(self._HoistableConstants(interface), | 128 secondary_constants = sorted(self._HoistableConstants(interface), |
129 ConstantOutputOrder) | 129 ConstantOutputOrder) |
130 for const in secondary_constants: | 130 for const in secondary_constants: |
131 self.AddConstant(const) | 131 self.AddConstant(const) |
132 | 132 |
133 secondary_parents = self._database.TransitiveSecondaryParents(interface, | 133 secondary_parents = self._database.TransitiveSecondaryParents(interface, |
134 not self._dart_use_blink) | 134 not self._dart_use_blink) |
| 135 remove_duplicate_parents = list(set(secondary_parents)) |
| 136 if len(secondary_parents) != len(remove_duplicate_parents): |
| 137 secondary_parents = remove_duplicate_parents |
| 138 parent_list = ", ".join([" %s" % (parent.id) for parent in secondary_pare
nts]) |
| 139 _logger.warn('Interface %s has duplicate parent interfaces %s - ' \ |
| 140 'ignoring duplicates. Please file a bug with the dart:html te
am.' % (interface.id, parent_list)) |
| 141 |
135 for parent_interface in sorted(secondary_parents): | 142 for parent_interface in sorted(secondary_parents): |
136 if isinstance(parent_interface, str): | 143 if isinstance(parent_interface, str): |
137 continue | 144 continue |
138 | 145 |
139 for attr in sorted(parent_interface.attributes, ConstantOutputOrder): | 146 for attr in sorted(parent_interface.attributes, ConstantOutputOrder): |
140 if not FindMatchingAttribute(interface, attr): | 147 if not FindMatchingAttribute(interface, attr): |
141 if attr.type.id != 'EventHandler': | 148 if attr.type.id != 'EventHandler': |
142 self.SecondaryContext(parent_interface) | 149 self.SecondaryContext(parent_interface) |
143 self.AddAttribute(attr) | 150 self.AddAttribute(attr) |
144 | 151 |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 def _InputType(self, type_name, info): | 887 def _InputType(self, type_name, info): |
881 conversion = self._InputConversion(type_name, info.declared_name) | 888 conversion = self._InputConversion(type_name, info.declared_name) |
882 if conversion: | 889 if conversion: |
883 return conversion.input_type | 890 return conversion.input_type |
884 else: | 891 else: |
885 # If typedef it's a union return dynamic. | 892 # If typedef it's a union return dynamic. |
886 if self._database.HasTypeDef(type_name): | 893 if self._database.HasTypeDef(type_name): |
887 return 'dynamic' | 894 return 'dynamic' |
888 else: | 895 else: |
889 return self._NarrowInputType(type_name) if type_name else 'dynamic' | 896 return self._NarrowInputType(type_name) if type_name else 'dynamic' |
OLD | NEW |