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

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

Issue 19820007: Fixes for Blink roll. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minors fixes Created 7 years, 5 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 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 ['DOMWindow', 'WorkerContext'] and 89 if not (interface.id in ['Window', 'WorkerContext'] and
90 type_name.endswith('Constructor')): 90 type_name.endswith('Constructor')):
91 _logger.warn('removing %s in %s which has unidentified type %s' % 91 _logger.warn('removing %s in %s which has unidentified type %s' %
92 (node_name, interface.id, type_name)) 92 (node_name, interface.id, type_name))
93 return False 93 return False
94 return True 94 return True
95 95
96 interface.constants = filter(IsIdentified, interface.constants) 96 interface.constants = filter(IsIdentified, interface.constants)
97 interface.attributes = filter(IsIdentified, interface.attributes) 97 interface.attributes = filter(IsIdentified, interface.attributes)
98 interface.operations = filter(IsIdentified, interface.operations) 98 interface.operations = filter(IsIdentified, interface.operations)
99 interface.parents = filter(IsIdentified, interface.parents) 99 interface.parents = filter(IsIdentified, interface.parents)
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 # 'EventTarget' extended attribute. 206 # 'EventTarget' extended attribute.
207 if 'EventTarget' in interface.ext_attrs and interface.id != 'EventTarget': 207 if 'EventTarget' in interface.ext_attrs and interface.id != 'EventTarget':
208 ast = [('Annotation', [('Id', 'WebKit')]), 208 ast = [('Annotation', [('Id', 'WebKit')]),
209 ('InterfaceType', ('ScopedName', 'EventTarget'))] 209 ('InterfaceType', ('ScopedName', 'EventTarget'))]
210 interface.parents.append(idlnode.IDLParentInterface(ast)) 210 interface.parents.append(idlnode.IDLParentInterface(ast))
211 211
212 def AddMissingArguments(self, database): 212 def AddMissingArguments(self, database):
213 ARG = idlnode.IDLArgument([('Type', ('ScopedName', 'object')), ('Id', 'arg') ]) 213 ARG = idlnode.IDLArgument([('Type', ('ScopedName', 'object')), ('Id', 'arg') ])
214 for interface in database.GetInterfaces(): 214 for interface in database.GetInterfaces():
215 for operation in interface.operations: 215 for operation in interface.operations:
216 call_with = operation.ext_attrs.get('CallWith', '').split('|') 216 call_with = (operation.ext_attrs.get('CallWith', '').split('|') +
217 operation.ext_attrs.get('ConstructorCallWith', '').split('| '))
217 if 'ScriptArguments' in call_with: 218 if 'ScriptArguments' in call_with:
218 operation.arguments.append(ARG) 219 operation.arguments.append(ARG)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698