| 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 self.AddOperation(info) | 134 if info.IsStatic(): |
| 135 self.AddStaticOperation(info) |
| 136 else: |
| 137 self.AddOperation(info) |
| 135 | 138 |
| 136 def AddSecondaryMembers(self, interface): | 139 def AddSecondaryMembers(self, interface): |
| 137 # With multiple inheritance, attributes and operations of non-first | 140 # With multiple inheritance, attributes and operations of non-first |
| 138 # interfaces need to be added. Sometimes the attribute or operation is | 141 # interfaces need to be added. Sometimes the attribute or operation is |
| 139 # defined in the current interface as well as a parent. In that case we | 142 # defined in the current interface as well as a parent. In that case we |
| 140 # avoid making a duplicate definition and pray that the signatures match. | 143 # avoid making a duplicate definition and pray that the signatures match. |
| 141 secondary_parents = self._TransitiveSecondaryParents(interface) | 144 secondary_parents = self._TransitiveSecondaryParents(interface) |
| 142 for parent_interface in secondary_parents: | 145 for parent_interface in secondary_parents: |
| 143 if isinstance(parent_interface, str): # IsDartCollectionType(parent_inter
face) | 146 if isinstance(parent_interface, str): # IsDartCollectionType(parent_inter
face) |
| 144 continue | 147 continue |
| (...skipping 23 matching lines...) Expand all Loading... |
| 168 | 171 |
| 169 def AddIndexer(self, element_type): | 172 def AddIndexer(self, element_type): |
| 170 pass | 173 pass |
| 171 | 174 |
| 172 def AmendIndexer(self, element_type): | 175 def AmendIndexer(self, element_type): |
| 173 pass | 176 pass |
| 174 | 177 |
| 175 def AddOperation(self, info): | 178 def AddOperation(self, info): |
| 176 pass | 179 pass |
| 177 | 180 |
| 181 def AddStaticOperation(self, info): |
| 182 pass |
| 183 |
| 178 def AddSecondaryAttribute(self, interface, attribute): | 184 def AddSecondaryAttribute(self, interface, attribute): |
| 179 pass | 185 pass |
| 180 | 186 |
| 181 def AddSecondaryOperation(self, interface, info): | 187 def AddSecondaryOperation(self, interface, info): |
| 182 pass | 188 pass |
| 183 | 189 |
| 184 def _TransitiveSecondaryParents(self, interface): | 190 def _TransitiveSecondaryParents(self, interface): |
| 185 """Returns a list of all non-primary parents. | 191 """Returns a list of all non-primary parents. |
| 186 | 192 |
| 187 The list contains the interface objects for interfaces defined in the | 193 The list contains the interface objects for interfaces defined in the |
| (...skipping 29 matching lines...) Expand all Loading... |
| 217 self.database = database | 223 self.database = database |
| 218 self.emitters = emitters | 224 self.emitters = emitters |
| 219 self.type_registry = type_registry | 225 self.type_registry = type_registry |
| 220 self.renamer = renamer | 226 self.renamer = renamer |
| 221 self.output_dir = output_dir | 227 self.output_dir = output_dir |
| 222 self.auxiliary_dir = auxiliary_dir | 228 self.auxiliary_dir = auxiliary_dir |
| 223 | 229 |
| 224 | 230 |
| 225 def IsReadOnly(attribute): | 231 def IsReadOnly(attribute): |
| 226 return attribute.is_read_only or 'Replaceable' in attribute.ext_attrs | 232 return attribute.is_read_only or 'Replaceable' in attribute.ext_attrs |
| OLD | NEW |