Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(726)

Side by Side Diff: lib/html/scripts/dartgenerator.py

Issue 11018012: Get rid of System class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 if HasAnnotations(interface): 182 if HasAnnotations(interface):
183 interface.constants = filter(HasAnnotations, interface.constants) 183 interface.constants = filter(HasAnnotations, interface.constants)
184 interface.attributes = filter(HasAnnotations, interface.attributes) 184 interface.attributes = filter(HasAnnotations, interface.attributes)
185 interface.operations = filter(HasAnnotations, interface.operations) 185 interface.operations = filter(HasAnnotations, interface.operations)
186 interface.parents = filter(HasAnnotations, interface.parents) 186 interface.parents = filter(HasAnnotations, interface.parents)
187 else: 187 else:
188 database.DeleteInterface(interface.id) 188 database.DeleteInterface(interface.id)
189 189
190 self.FilterMembersWithUnidentifiedTypes(database) 190 self.FilterMembersWithUnidentifiedTypes(database)
191 191
192 def Generate(self, database, system, super_database=None, webkit_renames={}): 192 def Generate(self, database, super_database, webkit_renames,
193 generate_interface):
193 self._database = database 194 self._database = database
194 195
195 # Collect interfaces 196 # Collect interfaces
196 interfaces = [] 197 interfaces = []
197 for interface in database.GetInterfaces(): 198 for interface in database.GetInterfaces():
198 if not MatchSourceFilter(interface): 199 if not MatchSourceFilter(interface):
199 # Skip this interface since it's not present in the required source 200 # Skip this interface since it's not present in the required source
200 _logger.info('Omitting interface - %s' % interface.id) 201 _logger.info('Omitting interface - %s' % interface.id)
201 continue 202 continue
202 interfaces.append(interface) 203 interfaces.append(interface)
(...skipping 17 matching lines...) Expand all
220 interface.ext_attrs['synthesizedSuperInterfaceName'] = super_name 221 interface.ext_attrs['synthesizedSuperInterfaceName'] = super_name
221 222
222 interface_name = interface.id 223 interface_name = interface.id
223 auxiliary_file = self._auxiliary_files.get(interface_name) 224 auxiliary_file = self._auxiliary_files.get(interface_name)
224 if auxiliary_file is not None: 225 if auxiliary_file is not None:
225 _logger.info('Skipping %s because %s exists' % ( 226 _logger.info('Skipping %s because %s exists' % (
226 interface_name, auxiliary_file)) 227 interface_name, auxiliary_file))
227 continue 228 continue
228 229
229 _logger.info('Generating %s' % interface.id) 230 _logger.info('Generating %s' % interface.id)
230 system.ProcessInterface(interface) 231 generate_interface(interface)
231 232
232 def _PreOrderInterfaces(self, interfaces): 233 def _PreOrderInterfaces(self, interfaces):
233 """Returns the interfaces in pre-order, i.e. parents first.""" 234 """Returns the interfaces in pre-order, i.e. parents first."""
234 seen = set() 235 seen = set()
235 ordered = [] 236 ordered = []
236 def visit(interface): 237 def visit(interface):
237 if interface.id in seen: 238 if interface.id in seen:
238 return 239 return
239 seen.add(interface.id) 240 seen.add(interface.id)
240 for parent in interface.parents: 241 for parent in interface.parents:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 ast = [('Annotation', [('Id', 'WebKit')]), 273 ast = [('Annotation', [('Id', 'WebKit')]),
273 ('InterfaceType', ('ScopedName', 'EventTarget'))] 274 ('InterfaceType', ('ScopedName', 'EventTarget'))]
274 interface.parents.append(idlnode.IDLParentInterface(ast)) 275 interface.parents.append(idlnode.IDLParentInterface(ast))
275 276
276 def AddMissingArguments(self, database): 277 def AddMissingArguments(self, database):
277 ARG = idlnode.IDLArgument([('Type', ('ScopedName', 'Object')), ('Id', 'arg') ]) 278 ARG = idlnode.IDLArgument([('Type', ('ScopedName', 'Object')), ('Id', 'arg') ])
278 for interface in database.GetInterfaces(): 279 for interface in database.GetInterfaces():
279 for operation in interface.operations: 280 for operation in interface.operations:
280 if operation.ext_attrs.get('CallWith') == 'ScriptArguments|CallStack': 281 if operation.ext_attrs.get('CallWith') == 'ScriptArguments|CallStack':
281 operation.arguments.append(ARG) 282 operation.arguments.append(ARG)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698