| 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 base functionality for systems to generate | 6 """This module provides base functionality for systems to generate |
| 7 Dart APIs from the IDL database.""" | 7 Dart APIs from the IDL database.""" |
| 8 | 8 |
| 9 import os | 9 import os |
| 10 from generator import * | 10 from generator import * |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 operationsById = {} | 124 operationsById = {} |
| 125 for operation in interface.operations: | 125 for operation in interface.operations: |
| 126 if operation.id not in operationsById: | 126 if operation.id not in operationsById: |
| 127 operationsById[operation.id] = [] | 127 operationsById[operation.id] = [] |
| 128 operationsById[operation.id].append(operation) | 128 operationsById[operation.id].append(operation) |
| 129 | 129 |
| 130 # Generate operations | 130 # Generate operations |
| 131 for id in sorted(operationsById.keys()): | 131 for id in sorted(operationsById.keys()): |
| 132 operations = operationsById[id] | 132 operations = operationsById[id] |
| 133 info = AnalyzeOperation(interface, operations) | 133 info = AnalyzeOperation(interface, operations) |
| 134 if info.IsStatic(): | 134 self.AddOperation(info) |
| 135 self.AddStaticOperation(info) | |
| 136 else: | |
| 137 self.AddOperation(info) | |
| 138 | 135 |
| 139 def AddSecondaryMembers(self, interface): | 136 def AddSecondaryMembers(self, interface): |
| 140 # With multiple inheritance, attributes and operations of non-first | 137 # With multiple inheritance, attributes and operations of non-first |
| 141 # interfaces need to be added. Sometimes the attribute or operation is | 138 # interfaces need to be added. Sometimes the attribute or operation is |
| 142 # defined in the current interface as well as a parent. In that case we | 139 # defined in the current interface as well as a parent. In that case we |
| 143 # avoid making a duplicate definition and pray that the signatures match. | 140 # avoid making a duplicate definition and pray that the signatures match. |
| 144 secondary_parents = self._TransitiveSecondaryParents(interface) | 141 secondary_parents = self._TransitiveSecondaryParents(interface) |
| 145 for parent_interface in secondary_parents: | 142 for parent_interface in secondary_parents: |
| 146 if isinstance(parent_interface, str): # IsDartCollectionType(parent_inter
face) | 143 if isinstance(parent_interface, str): # IsDartCollectionType(parent_inter
face) |
| 147 continue | 144 continue |
| (...skipping 23 matching lines...) Expand all Loading... |
| 171 | 168 |
| 172 def AddIndexer(self, element_type): | 169 def AddIndexer(self, element_type): |
| 173 pass | 170 pass |
| 174 | 171 |
| 175 def AmendIndexer(self, element_type): | 172 def AmendIndexer(self, element_type): |
| 176 pass | 173 pass |
| 177 | 174 |
| 178 def AddOperation(self, info): | 175 def AddOperation(self, info): |
| 179 pass | 176 pass |
| 180 | 177 |
| 181 def AddStaticOperation(self, info): | |
| 182 pass | |
| 183 | |
| 184 def AddSecondaryAttribute(self, interface, attribute): | 178 def AddSecondaryAttribute(self, interface, attribute): |
| 185 pass | 179 pass |
| 186 | 180 |
| 187 def AddSecondaryOperation(self, interface, info): | 181 def AddSecondaryOperation(self, interface, info): |
| 188 pass | 182 pass |
| 189 | 183 |
| 190 def _TransitiveSecondaryParents(self, interface): | 184 def _TransitiveSecondaryParents(self, interface): |
| 191 """Returns a list of all non-primary parents. | 185 """Returns a list of all non-primary parents. |
| 192 | 186 |
| 193 The list contains the interface objects for interfaces defined in the | 187 The list contains the interface objects for interfaces defined in the |
| (...skipping 29 matching lines...) Expand all Loading... |
| 223 self.database = database | 217 self.database = database |
| 224 self.emitters = emitters | 218 self.emitters = emitters |
| 225 self.type_registry = type_registry | 219 self.type_registry = type_registry |
| 226 self.renamer = renamer | 220 self.renamer = renamer |
| 227 self.output_dir = output_dir | 221 self.output_dir = output_dir |
| 228 self.auxiliary_dir = auxiliary_dir | 222 self.auxiliary_dir = auxiliary_dir |
| 229 | 223 |
| 230 | 224 |
| 231 def IsReadOnly(attribute): | 225 def IsReadOnly(attribute): |
| 232 return attribute.is_read_only or 'Replaceable' in attribute.ext_attrs | 226 return attribute.is_read_only or 'Replaceable' in attribute.ext_attrs |
| OLD | NEW |