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

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

Issue 10548065: Revert "Fix DataView constructor and byte accessors." (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/idl/dart/dart.idl ('k') | lib/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 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 conversion_cast = '%s::create(%s)' 706 conversion_cast = '%s::create(%s)'
705 else: 707 else:
706 conversion_cast = 'static_cast<%s*>(%s)' 708 conversion_cast = 'static_cast<%s*>(%s)'
707 conversion_cast = conversion_cast % (self.native_type(), value) 709 conversion_cast = conversion_cast % (self.native_type(), value)
708 return 'Dart%s::toDart(%s)' % (self._idl_type, conversion_cast) 710 return 'Dart%s::toDart(%s)' % (self._idl_type, conversion_cast)
709 711
710 _idl_type_registry = { 712 _idl_type_registry = {
711 'boolean': PrimitiveIDLTypeInfo('boolean', dart_type='bool', native_type='bo ol', 713 'boolean': PrimitiveIDLTypeInfo('boolean', dart_type='bool', native_type='bo ol',
712 webcore_getter_name='hasAttribute', 714 webcore_getter_name='hasAttribute',
713 webcore_setter_name='setBooleanAttribute'), 715 webcore_setter_name='setBooleanAttribute'),
714 'byte': PrimitiveIDLTypeInfo('byte', dart_type='int', native_type='int'),
715 'octet': PrimitiveIDLTypeInfo('octet', dart_type='int', native_type='int'),
716 'short': PrimitiveIDLTypeInfo('short', dart_type='int', native_type='int'), 716 'short': PrimitiveIDLTypeInfo('short', dart_type='int', native_type='int'),
717 'unsigned short': PrimitiveIDLTypeInfo('unsigned short', dart_type='int', 717 'unsigned short': PrimitiveIDLTypeInfo('unsigned short', dart_type='int',
718 native_type='int'), 718 native_type='int'),
719 'int': PrimitiveIDLTypeInfo('int', dart_type='int'), 719 'int': PrimitiveIDLTypeInfo('int', dart_type='int'),
720 'unsigned int': PrimitiveIDLTypeInfo('unsigned int', dart_type='int', 720 'unsigned int': PrimitiveIDLTypeInfo('unsigned int', dart_type='int',
721 native_type='unsigned'), 721 native_type='unsigned'),
722 'long': PrimitiveIDLTypeInfo('long', dart_type='int', native_type='int', 722 'long': PrimitiveIDLTypeInfo('long', dart_type='int', native_type='int',
723 webcore_getter_name='getIntegralAttribute', 723 webcore_getter_name='getIntegralAttribute',
724 webcore_setter_name='setIntegralAttribute'), 724 webcore_setter_name='setIntegralAttribute'),
725 'unsigned long': PrimitiveIDLTypeInfo('unsigned long', dart_type='int', 725 'unsigned long': PrimitiveIDLTypeInfo('unsigned long', dart_type='int',
(...skipping 69 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/idl/dart/dart.idl ('k') | lib/dom/scripts/systemnative.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698