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

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

Issue 9500012: Get rid of GetIDLTypeInfoByName. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 | « no previous file | client/dom/scripts/systemnative.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 re 9 import re
10 10
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 def MatchSourceFilter(filter, thing): 222 def MatchSourceFilter(filter, thing):
223 if not filter: 223 if not filter:
224 return True 224 return True
225 else: 225 else:
226 return any(token in thing.annotations for token in filter) 226 return any(token in thing.annotations for token in filter)
227 227
228 def DartType(idl_type_name): 228 def DartType(idl_type_name):
229 match = re.match(r'sequence<(\w*)>$', idl_type_name) 229 match = re.match(r'sequence<(\w*)>$', idl_type_name)
230 if match: 230 if match:
231 return 'List<%s>' % GetIDLTypeInfoByName(match.group(1)).dart_type() 231 return 'List<%s>' % GetIDLTypeInfo(match.group(1)).dart_type()
232 return GetIDLTypeInfoByName(idl_type_name).dart_type() 232 return GetIDLTypeInfo(idl_type_name).dart_type()
233 233
234 # Given a list of overloaded arguments, render a dart argument. 234 # Given a list of overloaded arguments, render a dart argument.
235 def _DartArg(args, interface): 235 def _DartArg(args, interface):
236 # Given a list of overloaded arguments, choose a suitable name. 236 # Given a list of overloaded arguments, choose a suitable name.
237 def OverloadedName(args): 237 def OverloadedName(args):
238 return '_OR_'.join(sorted(set(arg.id for arg in args))) 238 return '_OR_'.join(sorted(set(arg.id for arg in args)))
239 239
240 # Given a list of overloaded arguments, choose a suitable type. 240 # Given a list of overloaded arguments, choose a suitable type.
241 def OverloadedType(args): 241 def OverloadedType(args):
242 typeIds = sorted(set(DartType(arg.type.id) for arg in args)) 242 typeIds = sorted(set(DartType(arg.type.id) for arg in args))
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 'SVGPathSegList': SVGTearOffIDLTypeInfo('SVGPathSegList', native_type='SVGPa thSegListPropertyTearOff', ref_counted=False), 619 'SVGPathSegList': SVGTearOffIDLTypeInfo('SVGPathSegList', native_type='SVGPa thSegListPropertyTearOff', ref_counted=False),
620 'SVGPoint': SVGTearOffIDLTypeInfo('SVGPoint', native_type='SVGPropertyTearOf f<FloatPoint>'), 620 'SVGPoint': SVGTearOffIDLTypeInfo('SVGPoint', native_type='SVGPropertyTearOf f<FloatPoint>'),
621 'SVGPointList': SVGTearOffIDLTypeInfo('SVGPointList', ref_counted=False), 621 'SVGPointList': SVGTearOffIDLTypeInfo('SVGPointList', ref_counted=False),
622 'SVGPreserveAspectRatio': SVGTearOffIDLTypeInfo('SVGPreserveAspectRatio'), 622 'SVGPreserveAspectRatio': SVGTearOffIDLTypeInfo('SVGPreserveAspectRatio'),
623 'SVGRect': SVGTearOffIDLTypeInfo('SVGRect', native_type='SVGPropertyTearOff< FloatRect>'), 623 'SVGRect': SVGTearOffIDLTypeInfo('SVGRect', native_type='SVGPropertyTearOff< FloatRect>'),
624 'SVGStringList': SVGTearOffIDLTypeInfo('SVGStringList', native_type='SVGStat icListPropertyTearOff<SVGStringList>', ref_counted=False), 624 'SVGStringList': SVGTearOffIDLTypeInfo('SVGStringList', native_type='SVGStat icListPropertyTearOff<SVGStringList>', ref_counted=False),
625 'SVGTransform': SVGTearOffIDLTypeInfo('SVGTransform'), 625 'SVGTransform': SVGTearOffIDLTypeInfo('SVGTransform'),
626 'SVGTransformList': SVGTearOffIDLTypeInfo('SVGTransformList', native_type='S VGTransformListPropertyTearOff', ref_counted=False) 626 'SVGTransformList': SVGTearOffIDLTypeInfo('SVGTransformList', native_type='S VGTransformListPropertyTearOff', ref_counted=False)
627 } 627 }
628 628
629 def GetIDLTypeInfo(idl_type): 629 def GetIDLTypeInfo(idl_type_name):
630 return GetIDLTypeInfoByName(idl_type.id)
631
632 def GetIDLTypeInfoByName(idl_type_name):
633 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) 630 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name))
OLDNEW
« no previous file with comments | « no previous file | client/dom/scripts/systemnative.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698