| 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 provides shared functionality for systems to generate | 6 """This module provides shared functionality for systems to generate |
| 7 Dart APIs from the IDL database.""" | 7 Dart APIs from the IDL database.""" |
| 8 | 8 |
| 9 import re | 9 import re |
| 10 | 10 |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 """ | 278 """ |
| 279 def GetArgs(func_value): | 279 def GetArgs(func_value): |
| 280 return map(lambda arg: _DartArg([arg], interface), func_value.arguments) | 280 return map(lambda arg: _DartArg([arg], interface), func_value.arguments) |
| 281 | 281 |
| 282 if 'Constructor' in interface.ext_attrs: | 282 if 'Constructor' in interface.ext_attrs: |
| 283 name = None | 283 name = None |
| 284 func_value = interface.ext_attrs.get('Constructor') | 284 func_value = interface.ext_attrs.get('Constructor') |
| 285 if func_value: | 285 if func_value: |
| 286 # [Constructor(param,...)] | 286 # [Constructor(param,...)] |
| 287 args = GetArgs(func_value) | 287 args = GetArgs(func_value) |
| 288 idl_args = func_value.arguments |
| 288 else: # [Constructor] | 289 else: # [Constructor] |
| 289 args = [] | 290 args = [] |
| 291 idl_args = [] |
| 290 else: | 292 else: |
| 291 func_value = interface.ext_attrs.get('NamedConstructor') | 293 func_value = interface.ext_attrs.get('NamedConstructor') |
| 292 if func_value: | 294 if func_value: |
| 293 name = func_value.id | 295 name = func_value.id |
| 294 args = GetArgs(func_value) | 296 args = GetArgs(func_value) |
| 297 idl_args = func_value.arguments |
| 295 else: | 298 else: |
| 296 return None | 299 return None |
| 297 | 300 |
| 298 info = OperationInfo() | 301 info = OperationInfo() |
| 299 info.overloads = None # [func_value] | 302 info.overloads = None |
| 303 info.idl_args = idl_args |
| 300 info.declared_name = name | 304 info.declared_name = name |
| 301 info.name = name | 305 info.name = name |
| 302 info.js_name = name | 306 info.js_name = name |
| 303 info.type_name = interface.id | 307 info.type_name = interface.id |
| 304 info.arg_infos = args | 308 info.arg_infos = args |
| 305 return info | 309 return info |
| 306 | 310 |
| 307 | 311 |
| 308 def RecognizeCallback(interface): | 312 def RecognizeCallback(interface): |
| 309 """Returns the info for the callback method if the interface smells like a | 313 """Returns the info for the callback method if the interface smells like a |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 | 602 |
| 599 original_idl_types = { | 603 original_idl_types = { |
| 600 } | 604 } |
| 601 | 605 |
| 602 def GetIDLTypeInfo(idl_type): | 606 def GetIDLTypeInfo(idl_type): |
| 603 idl_type_name = original_idl_types.get(idl_type, idl_type.id) | 607 idl_type_name = original_idl_types.get(idl_type, idl_type.id) |
| 604 return GetIDLTypeInfoByName(idl_type_name) | 608 return GetIDLTypeInfoByName(idl_type_name) |
| 605 | 609 |
| 606 def GetIDLTypeInfoByName(idl_type_name): | 610 def GetIDLTypeInfoByName(idl_type_name): |
| 607 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) | 611 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) |
| OLD | NEW |