| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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) |
| OLD | NEW |