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

Side by Side Diff: lib/dom/scripts/generator.py

Issue 10533064: Support custom constructors with signature declaration. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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
« no previous file with comments | « lib/dom/scripts/fremontcutbuilder.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 def AnalyzeConstructor(interface): 269 def AnalyzeConstructor(interface):
270 """Returns an OperationInfo object for the constructor. 270 """Returns an OperationInfo object for the constructor.
271 271
272 Returns None if the interface has no Constructor. 272 Returns None if the interface has no Constructor.
273 """ 273 """
274 def GetArgs(func_value): 274 def GetArgs(func_value):
275 return map(lambda arg: _DartArg([arg], interface, True), 275 return map(lambda arg: _DartArg([arg], interface, True),
276 func_value.arguments) 276 func_value.arguments)
277 277
278 if 'CustomConstructor' in interface.ext_attrs:
279 return None
278 if 'Constructor' in interface.ext_attrs: 280 if 'Constructor' in interface.ext_attrs:
279 name = None 281 name = None
280 func_value = interface.ext_attrs.get('Constructor') 282 func_value = interface.ext_attrs.get('Constructor')
281 if func_value: 283 if func_value:
282 # [Constructor(param,...)] 284 # [Constructor(param,...)]
283 args = GetArgs(func_value) 285 args = GetArgs(func_value)
284 idl_args = func_value.arguments 286 idl_args = func_value.arguments
285 else: # [Constructor] 287 else: # [Constructor]
286 args = [] 288 args = []
287 idl_args = [] 289 idl_args = []
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 '"SVGAnimatedListPropertyTearOff.h"', 795 '"SVGAnimatedListPropertyTearOff.h"',
794 '"SVGTransformListPropertyTearOff.h"', 796 '"SVGTransformListPropertyTearOff.h"',
795 '"SVGPathSegListPropertyTearOff.h"', 797 '"SVGPathSegListPropertyTearOff.h"',
796 ] 798 ]
797 799
798 def GetIDLTypeInfo(idl_type_name): 800 def GetIDLTypeInfo(idl_type_name):
799 match = re.match(r'sequence<(\w+)>$', idl_type_name) 801 match = re.match(r'sequence<(\w+)>$', idl_type_name)
800 if match: 802 if match:
801 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) 803 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1)))
802 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) 804 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name))
OLDNEW
« no previous file with comments | « lib/dom/scripts/fremontcutbuilder.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698