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

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

Issue 10986048: Get rid of System classes for backend generators. (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
« no previous file with comments | « lib/html/scripts/dartdomgenerator.py ('k') | lib/html/scripts/systembase.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 super_database.HasInterface(super_name)): 219 super_database.HasInterface(super_name)):
220 interface.ext_attrs['synthesizedSuperInterfaceName'] = super_name 220 interface.ext_attrs['synthesizedSuperInterfaceName'] = super_name
221 221
222 interface_name = interface.id 222 interface_name = interface.id
223 auxiliary_file = self._auxiliary_files.get(interface_name) 223 auxiliary_file = self._auxiliary_files.get(interface_name)
224 if auxiliary_file is not None: 224 if auxiliary_file is not None:
225 _logger.info('Skipping %s because %s exists' % ( 225 _logger.info('Skipping %s because %s exists' % (
226 interface_name, auxiliary_file)) 226 interface_name, auxiliary_file))
227 continue 227 continue
228 228
229 if 'Callback' in interface.ext_attrs: 229 _logger.info('Generating %s' % interface.id)
230 handlers = [op for op in interface.operations if op.id == 'handleEvent'] 230 system.ProcessInterface(interface)
231 info = AnalyzeOperation(interface, handlers)
232 system.ProcessCallback(interface, info)
233 else:
234 _logger.info('Generating %s' % interface.id)
235 system.ProcessInterface(interface)
236 231
237 def _PreOrderInterfaces(self, interfaces): 232 def _PreOrderInterfaces(self, interfaces):
238 """Returns the interfaces in pre-order, i.e. parents first.""" 233 """Returns the interfaces in pre-order, i.e. parents first."""
239 seen = set() 234 seen = set()
240 ordered = [] 235 ordered = []
241 def visit(interface): 236 def visit(interface):
242 if interface.id in seen: 237 if interface.id in seen:
243 return 238 return
244 seen.add(interface.id) 239 seen.add(interface.id)
245 for parent in interface.parents: 240 for parent in interface.parents:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 ast = [('Annotation', [('Id', 'WebKit')]), 272 ast = [('Annotation', [('Id', 'WebKit')]),
278 ('InterfaceType', ('ScopedName', 'EventTarget'))] 273 ('InterfaceType', ('ScopedName', 'EventTarget'))]
279 interface.parents.append(idlnode.IDLParentInterface(ast)) 274 interface.parents.append(idlnode.IDLParentInterface(ast))
280 275
281 def AddMissingArguments(self, database): 276 def AddMissingArguments(self, database):
282 ARG = idlnode.IDLArgument([('Type', ('ScopedName', 'Object')), ('Id', 'arg') ]) 277 ARG = idlnode.IDLArgument([('Type', ('ScopedName', 'Object')), ('Id', 'arg') ])
283 for interface in database.GetInterfaces(): 278 for interface in database.GetInterfaces():
284 for operation in interface.operations: 279 for operation in interface.operations:
285 if operation.ext_attrs.get('CallWith') == 'ScriptArguments|CallStack': 280 if operation.ext_attrs.get('CallWith') == 'ScriptArguments|CallStack':
286 operation.arguments.append(ARG) 281 operation.arguments.append(ARG)
OLDNEW
« no previous file with comments | « lib/html/scripts/dartdomgenerator.py ('k') | lib/html/scripts/systembase.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698