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

Side by Side Diff: tools/dom/scripts/dartgenerator.py

Issue 23889005: Cleaning up a bunch of DOM generation tables (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 | « tools/dom/dom.json ('k') | tools/dom/scripts/dartmetadata.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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 for interface in database.GetInterfaces(): 80 for interface in database.GetInterfaces():
81 def IsIdentified(idl_node): 81 def IsIdentified(idl_node):
82 node_name = idl_node.id if idl_node.id else 'parent' 82 node_name = idl_node.id if idl_node.id else 'parent'
83 for idl_type in idl_node.all(idlnode.IDLType): 83 for idl_type in idl_node.all(idlnode.IDLType):
84 type_name = idl_type.id 84 type_name = idl_type.id
85 if (type_name is not None and 85 if (type_name is not None and
86 self._IsCompoundType(database, type_name)): 86 self._IsCompoundType(database, type_name)):
87 continue 87 continue
88 # Ignore constructor warnings. 88 # Ignore constructor warnings.
89 if not (interface.id in ['Window', 'WorkerContext'] and 89 if not (interface.id in ['Window', 'WorkerContext',
90 'WorkerGlobalScope'] and
90 type_name.endswith('Constructor')): 91 type_name.endswith('Constructor')):
91 _logger.warn('removing %s in %s which has unidentified type %s' % 92 _logger.warn('removing %s in %s which has unidentified type %s' %
92 (node_name, interface.id, type_name)) 93 (node_name, interface.id, type_name))
93 return False 94 return False
94 return True 95 return True
95 96
96 interface.constants = filter(IsIdentified, interface.constants) 97 interface.constants = filter(IsIdentified, interface.constants)
97 interface.attributes = filter(IsIdentified, interface.attributes) 98 interface.attributes = filter(IsIdentified, interface.attributes)
98 interface.operations = filter(IsIdentified, interface.operations) 99 interface.operations = filter(IsIdentified, interface.operations)
99 interface.parents = filter(IsIdentified, interface.parents) 100 interface.parents = filter(IsIdentified, interface.parents)
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 def AddMissingArguments(self, database): 227 def AddMissingArguments(self, database):
227 ARG = idlnode.IDLArgument([('Type', ('ScopedName', 'object')), ('Id', 'arg') ]) 228 ARG = idlnode.IDLArgument([('Type', ('ScopedName', 'object')), ('Id', 'arg') ])
228 for interface in database.GetInterfaces(): 229 for interface in database.GetInterfaces():
229 for operation in interface.operations: 230 for operation in interface.operations:
230 call_with = (operation.ext_attrs.get('CallWith', '').split('|') + 231 call_with = (operation.ext_attrs.get('CallWith', '').split('|') +
231 operation.ext_attrs.get('ConstructorCallWith', '').split('| ') + 232 operation.ext_attrs.get('ConstructorCallWith', '').split('| ') +
232 operation.ext_attrs.get('CallWith', '').split('&') + 233 operation.ext_attrs.get('CallWith', '').split('&') +
233 operation.ext_attrs.get('ConstructorCallWith', '').split('& ')) 234 operation.ext_attrs.get('ConstructorCallWith', '').split('& '))
234 if 'ScriptArguments' in call_with: 235 if 'ScriptArguments' in call_with:
235 operation.arguments.append(ARG) 236 operation.arguments.append(ARG)
OLDNEW
« no previous file with comments | « tools/dom/dom.json ('k') | tools/dom/scripts/dartmetadata.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698