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

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

Issue 10542036: Use original WebKit IDL database for dart:html generation. (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/dartgenerator.py ('k') | lib/dom/scripts/systemfrog.py » ('j') | 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 380
381 Attributes: 381 Attributes:
382 overloads: A list of IDL operation overloads with the same name. 382 overloads: A list of IDL operation overloads with the same name.
383 name: A string, the simple name of the operation. 383 name: A string, the simple name of the operation.
384 constructor_name: A string, the name of the constructor iff the constructor 384 constructor_name: A string, the name of the constructor iff the constructor
385 is named, e.g. 'fromList' in Int8Array.fromList(list). 385 is named, e.g. 'fromList' in Int8Array.fromList(list).
386 type_name: A string, the name of the return type of the operation. 386 type_name: A string, the name of the return type of the operation.
387 param_infos: A list of ParamInfo. 387 param_infos: A list of ParamInfo.
388 """ 388 """
389 389
390 def ParametersInterfaceDeclaration(self): 390 def ParametersInterfaceDeclaration(self, rename_type=lambda x: x):
391 """Returns a formatted string declaring the parameters for the interface.""" 391 """Returns a formatted string declaring the parameters for the interface."""
392 return self._FormatParams( 392 return self._FormatParams(
393 self.param_infos, None, 393 self.param_infos, None,
394 lambda param: TypeOrNothing(param.dart_type, param.type_id)) 394 lambda param: TypeOrNothing(rename_type(param.dart_type), param.type_id) )
395 395
396 def ParametersImplementationDeclaration( 396 def ParametersImplementationDeclaration(
397 self, rename_type=None, default_value='null'): 397 self, rename_type=None, default_value='null'):
398 """Returns a formatted string declaring the parameters for the 398 """Returns a formatted string declaring the parameters for the
399 implementation. 399 implementation.
400 400
401 Args: 401 Args:
402 rename_type: A function that allows the types to be renamed. 402 rename_type: A function that allows the types to be renamed.
403 The function is applied to the parameter's dart_type. 403 The function is applied to the parameter's dart_type.
404 """ 404 """
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 '"SVGAnimatedListPropertyTearOff.h"', 795 '"SVGAnimatedListPropertyTearOff.h"',
796 '"SVGTransformListPropertyTearOff.h"', 796 '"SVGTransformListPropertyTearOff.h"',
797 '"SVGPathSegListPropertyTearOff.h"', 797 '"SVGPathSegListPropertyTearOff.h"',
798 ] 798 ]
799 799
800 def GetIDLTypeInfo(idl_type_name): 800 def GetIDLTypeInfo(idl_type_name):
801 match = re.match(r'sequence<(\w+)>$', idl_type_name) 801 match = re.match(r'sequence<(\w+)>$', idl_type_name)
802 if match: 802 if match:
803 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) 803 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1)))
804 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/dartgenerator.py ('k') | lib/dom/scripts/systemfrog.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698