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

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

Issue 27358002: Generate a class table of all the IDL classes in the database. This table is used (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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
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 json 10 import json
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 return self._data.merged_interface 787 return self._data.merged_interface
788 788
789 def merged_into(self): 789 def merged_into(self):
790 return self._data.merged_into 790 return self._data.merged_into
791 791
792 792
793 class CallbackIDLTypeInfo(IDLTypeInfo): 793 class CallbackIDLTypeInfo(IDLTypeInfo):
794 def __init__(self, idl_type, data): 794 def __init__(self, idl_type, data):
795 super(CallbackIDLTypeInfo, self).__init__(idl_type, data) 795 super(CallbackIDLTypeInfo, self).__init__(idl_type, data)
796 796
797 def implementation_name(self):
798 return ""
799
797 800
798 def array_type(data_type): 801 def array_type(data_type):
799 matched = re.match(r'([\w\d_\s]+)\[\]', data_type) 802 matched = re.match(r'([\w\d_\s]+)\[\]', data_type)
800 if not matched: 803 if not matched:
801 return None 804 return None
802 return matched.group(1) 805 return matched.group(1)
803 806
804 class SequenceIDLTypeInfo(IDLTypeInfo): 807 class SequenceIDLTypeInfo(IDLTypeInfo):
805 def __init__(self, idl_type, data, item_info): 808 def __init__(self, idl_type, data, item_info):
806 super(SequenceIDLTypeInfo, self).__init__(idl_type, data) 809 super(SequenceIDLTypeInfo, self).__init__(idl_type, data)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 854
852 class DOMStringArrayTypeInfo(SequenceIDLTypeInfo): 855 class DOMStringArrayTypeInfo(SequenceIDLTypeInfo):
853 def __init__(self, data, item_info): 856 def __init__(self, data, item_info):
854 super(DOMStringArrayTypeInfo, self).__init__('DOMString[]', data, item_info) 857 super(DOMStringArrayTypeInfo, self).__init__('DOMString[]', data, item_info)
855 858
856 def to_native_info(self, idl_node, interface_name): 859 def to_native_info(self, idl_node, interface_name):
857 return '%s', 'RefPtr<DOMStringList>', 'DartDOMStringList', 'toNative' 860 return '%s', 'RefPtr<DOMStringList>', 'DartDOMStringList', 'toNative'
858 861
859 def pass_native_by_ref(self): return False 862 def pass_native_by_ref(self): return False
860 863
864 def implementation_name(self):
865 return ""
866
861 867
862 class PrimitiveIDLTypeInfo(IDLTypeInfo): 868 class PrimitiveIDLTypeInfo(IDLTypeInfo):
863 def __init__(self, idl_type, data): 869 def __init__(self, idl_type, data):
864 super(PrimitiveIDLTypeInfo, self).__init__(idl_type, data) 870 super(PrimitiveIDLTypeInfo, self).__init__(idl_type, data)
865 871
866 def vector_to_dart_template_parameter(self): 872 def vector_to_dart_template_parameter(self):
867 # Ugly hack. Usually IDLs floats are treated as C++ doubles, however 873 # Ugly hack. Usually IDLs floats are treated as C++ doubles, however
868 # sequence<float> should map to Vector<float> 874 # sequence<float> should map to Vector<float>
869 if self.idl_type() == 'float': return 'float' 875 if self.idl_type() == 'float': return 'float'
870 return self.native_type() 876 return self.native_type()
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 if type_data.clazz == 'BasicTypedList': 1248 if type_data.clazz == 'BasicTypedList':
1243 if type_name == 'ArrayBuffer': 1249 if type_name == 'ArrayBuffer':
1244 dart_interface_name = 'ByteBuffer' 1250 dart_interface_name = 'ByteBuffer'
1245 else: 1251 else:
1246 dart_interface_name = self._renamer.RenameInterfaceId(type_name) 1252 dart_interface_name = self._renamer.RenameInterfaceId(type_name)
1247 return BasicTypedListIDLTypeInfo( 1253 return BasicTypedListIDLTypeInfo(
1248 type_name, type_data, dart_interface_name, self) 1254 type_name, type_data, dart_interface_name, self)
1249 1255
1250 class_name = '%sIDLTypeInfo' % type_data.clazz 1256 class_name = '%sIDLTypeInfo' % type_data.clazz
1251 return globals()[class_name](type_name, type_data) 1257 return globals()[class_name](type_name, type_data)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698