Chromium Code Reviews| 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 copy | 9 import copy |
| 10 import re | 10 import re |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 381 | 381 |
| 382 Attributes: | 382 Attributes: |
| 383 overloads: A list of IDL operation overloads with the same name. | 383 overloads: A list of IDL operation overloads with the same name. |
| 384 name: A string, the simple name of the operation. | 384 name: A string, the simple name of the operation. |
| 385 constructor_name: A string, the name of the constructor iff the constructor | 385 constructor_name: A string, the name of the constructor iff the constructor |
| 386 is named, e.g. 'fromList' in Int8Array.fromList(list). | 386 is named, e.g. 'fromList' in Int8Array.fromList(list). |
| 387 type_name: A string, the name of the return type of the operation. | 387 type_name: A string, the name of the return type of the operation. |
| 388 param_infos: A list of ParamInfo. | 388 param_infos: A list of ParamInfo. |
| 389 """ | 389 """ |
| 390 | 390 |
| 391 def ParametersInterfaceDeclaration(self): | 391 def ParametersInterfaceDeclaration(self, rename_type=None): |
|
Anton Muhin
2012/06/07 11:43:47
why not rename_type=lambda x: x?
podivilov
2012/06/08 18:03:25
Done.
| |
| 392 """Returns a formatted string declaring the parameters for the interface.""" | 392 """Returns a formatted string declaring the parameters for the interface.""" |
| 393 if not rename_type: | |
| 394 rename_type = lambda x: x | |
| 393 return self._FormatParams( | 395 return self._FormatParams( |
| 394 self.param_infos, True, | 396 self.param_infos, True, |
| 395 lambda param: TypeOrNothing(param.dart_type, param.type_id)) | 397 lambda param: TypeOrNothing(rename_type(param.dart_type), param.type_id) ) |
| 396 | 398 |
| 397 def ParametersImplementationDeclaration(self, rename_type=None): | 399 def ParametersImplementationDeclaration(self, rename_type=None): |
| 398 """Returns a formatted string declaring the parameters for the | 400 """Returns a formatted string declaring the parameters for the |
| 399 implementation. | 401 implementation. |
| 400 | 402 |
| 401 Args: | 403 Args: |
| 402 rename_type: A function that allows the types to be renamed. | 404 rename_type: A function that allows the types to be renamed. |
| 403 The function is applied to the parameter's dart_type. | 405 The function is applied to the parameter's dart_type. |
| 404 """ | 406 """ |
| 405 if rename_type: | 407 if rename_type: |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 796 '"SVGAnimatedListPropertyTearOff.h"', | 798 '"SVGAnimatedListPropertyTearOff.h"', |
| 797 '"SVGTransformListPropertyTearOff.h"', | 799 '"SVGTransformListPropertyTearOff.h"', |
| 798 '"SVGPathSegListPropertyTearOff.h"', | 800 '"SVGPathSegListPropertyTearOff.h"', |
| 799 ] | 801 ] |
| 800 | 802 |
| 801 def GetIDLTypeInfo(idl_type_name): | 803 def GetIDLTypeInfo(idl_type_name): |
| 802 match = re.match(r'sequence<(\w+)>$', idl_type_name) | 804 match = re.match(r'sequence<(\w+)>$', idl_type_name) |
| 803 if match: | 805 if match: |
| 804 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) | 806 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) |
| 805 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) | 807 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) |
| OLD | NEW |