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 generates Dart APIs from the IDL database.""" | 6 """This module generates Dart APIs from the IDL database.""" |
7 | 7 |
8 import emitter | 8 import emitter |
9 import idlnode | 9 import idlnode |
10 import logging | 10 import logging |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 if HasAnnotations(interface): | 179 if HasAnnotations(interface): |
180 interface.constants = filter(HasAnnotations, interface.constants) | 180 interface.constants = filter(HasAnnotations, interface.constants) |
181 interface.attributes = filter(HasAnnotations, interface.attributes) | 181 interface.attributes = filter(HasAnnotations, interface.attributes) |
182 interface.operations = filter(HasAnnotations, interface.operations) | 182 interface.operations = filter(HasAnnotations, interface.operations) |
183 interface.parents = filter(HasAnnotations, interface.parents) | 183 interface.parents = filter(HasAnnotations, interface.parents) |
184 else: | 184 else: |
185 database.DeleteInterface(interface.id) | 185 database.DeleteInterface(interface.id) |
186 | 186 |
187 self.FilterMembersWithUnidentifiedTypes(database) | 187 self.FilterMembersWithUnidentifiedTypes(database) |
188 | 188 |
189 def Generate(self, database, system, super_database=None, webkit_renames={}): | 189 def Generate(self, database, system, super_database=None, webkit_renames={}, |
190 interface_renames={}): | |
190 self._database = database | 191 self._database = database |
192 IDLTypeInfo.interface_renames = interface_renames | |
Anton Muhin
2012/07/05 15:55:53
that doesn't look like a simplification---it's har
podivilov
2012/07/05 16:00:06
Dart interface renames naturally belong to type re
Anton Muhin
2012/07/05 16:02:11
I do agree w/ it. But I hate this temporary set r
podivilov
2012/07/13 15:39:24
Done.
| |
191 | 193 |
192 # Collect interfaces | 194 # Collect interfaces |
193 interfaces = [] | 195 interfaces = [] |
194 for interface in database.GetInterfaces(): | 196 for interface in database.GetInterfaces(): |
195 if not MatchSourceFilter(interface): | 197 if not MatchSourceFilter(interface): |
196 # Skip this interface since it's not present in the required source | 198 # Skip this interface since it's not present in the required source |
197 _logger.info('Omitting interface - %s' % interface.id) | 199 _logger.info('Omitting interface - %s' % interface.id) |
198 continue | 200 continue |
199 interfaces.append(interface) | 201 interfaces.append(interface) |
200 | 202 |
(...skipping 26 matching lines...) Expand all Loading... | |
227 if info: | 229 if info: |
228 system.ProcessCallback(interface, info) | 230 system.ProcessCallback(interface, info) |
229 else: | 231 else: |
230 if 'Callback' in interface.ext_attrs: | 232 if 'Callback' in interface.ext_attrs: |
231 _logger.info('Malformed callback: %s' % interface.id) | 233 _logger.info('Malformed callback: %s' % interface.id) |
232 _logger.info('Generating %s' % interface.id) | 234 _logger.info('Generating %s' % interface.id) |
233 system.ProcessInterface(interface) | 235 system.ProcessInterface(interface) |
234 | 236 |
235 system.GenerateLibraries() | 237 system.GenerateLibraries() |
236 system.Finish() | 238 system.Finish() |
239 IDLTypeInfo.interface_renames = {} | |
237 | 240 |
238 def _PreOrderInterfaces(self, interfaces): | 241 def _PreOrderInterfaces(self, interfaces): |
239 """Returns the interfaces in pre-order, i.e. parents first.""" | 242 """Returns the interfaces in pre-order, i.e. parents first.""" |
240 seen = set() | 243 seen = set() |
241 ordered = [] | 244 ordered = [] |
242 def visit(interface): | 245 def visit(interface): |
243 if interface.id in seen: | 246 if interface.id in seen: |
244 return | 247 return |
245 seen.add(interface.id) | 248 seen.add(interface.id) |
246 for parent in interface.parents: | 249 for parent in interface.parents: |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 PARAMETERS=constructor_info.ParametersImplementationDeclaration()) | 340 PARAMETERS=constructor_info.ParametersImplementationDeclaration()) |
338 | 341 |
339 def FinishInterface(self): | 342 def FinishInterface(self): |
340 pass | 343 pass |
341 | 344 |
342 def AddTypedArrayConstructors(self, element_type): | 345 def AddTypedArrayConstructors(self, element_type): |
343 pass | 346 pass |
344 | 347 |
345 def AddEventAttributes(self, event_attrs): | 348 def AddEventAttributes(self, event_attrs): |
346 pass | 349 pass |
OLD | NEW |