| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 for operation in interface.operations: | 210 for operation in interface.operations: |
| 211 if operation.raises: | 211 if operation.raises: |
| 212 exceptions.add(operation.raises.id) | 212 exceptions.add(operation.raises.id) |
| 213 return exceptions | 213 return exceptions |
| 214 | 214 |
| 215 | 215 |
| 216 def FixEventTargets(self, database): | 216 def FixEventTargets(self, database): |
| 217 for interface in database.GetInterfaces(): | 217 for interface in database.GetInterfaces(): |
| 218 # Create fake EventTarget parent interface for interfaces that have | 218 # Create fake EventTarget parent interface for interfaces that have |
| 219 # 'EventTarget' extended attribute. | 219 # 'EventTarget' extended attribute. |
| 220 if 'EventTarget' in interface.ext_attrs: | 220 if 'EventTarget' in interface.ext_attrs and interface.id != 'EventTarget': |
| 221 ast = [('Annotation', [('Id', 'WebKit')]), | 221 ast = [('Annotation', [('Id', 'WebKit')]), |
| 222 ('InterfaceType', ('ScopedName', 'EventTarget'))] | 222 ('InterfaceType', ('ScopedName', 'EventTarget'))] |
| 223 interface.parents.append(idlnode.IDLParentInterface(ast)) | 223 interface.parents.append(idlnode.IDLParentInterface(ast)) |
| 224 | 224 |
| 225 def AddMissingArguments(self, database): | 225 def AddMissingArguments(self, database): |
| 226 ARG = idlnode.IDLArgument([('Type', ('ScopedName', 'object')), ('Id', 'arg')
]) | 226 ARG = idlnode.IDLArgument([('Type', ('ScopedName', 'object')), ('Id', 'arg')
]) |
| 227 for interface in database.GetInterfaces(): | 227 for interface in database.GetInterfaces(): |
| 228 for operation in interface.operations: | 228 for operation in interface.operations: |
| 229 if operation.ext_attrs.get('CallWith') == 'ScriptArguments|ScriptState': | 229 if operation.ext_attrs.get('CallWith') == 'ScriptArguments|ScriptState': |
| 230 operation.arguments.append(ARG) | 230 operation.arguments.append(ARG) |
| OLD | NEW |