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

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

Issue 644913002: Version 1.7.1 (Closed) Base URL: http://dart.googlecode.com/svn/branches/1.7/
Patch Set: Created 6 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
« no previous file with comments | « dart/tools/dom/scripts/dartgenerator.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 json 10 import json
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 1266
1267 def TypeInfo(self, type_name): 1267 def TypeInfo(self, type_name):
1268 if not type_name in self._cache: 1268 if not type_name in self._cache:
1269 self._cache[type_name] = self._TypeInfo(type_name) 1269 self._cache[type_name] = self._TypeInfo(type_name)
1270 return self._cache[type_name] 1270 return self._cache[type_name]
1271 1271
1272 def DartType(self, type_name): 1272 def DartType(self, type_name):
1273 return self.TypeInfo(type_name).dart_type() 1273 return self.TypeInfo(type_name).dart_type()
1274 1274
1275 def _TypeInfo(self, type_name): 1275 def _TypeInfo(self, type_name):
1276 match = re.match(r'(?:sequence<(\w+)>|(\w+)\[\])$', type_name) 1276 match = re.match(r'(?:sequence<([\w ]+)>|(\w+)\[\])$', type_name)
1277 if match: 1277 if match:
1278 type_data = TypeData('Sequence') 1278 type_data = TypeData('Sequence')
1279 item_info = self.TypeInfo(match.group(1) or match.group(2)) 1279 item_info = self.TypeInfo(match.group(1) or match.group(2))
1280 # TODO(vsm): Generalize this code. 1280 # TODO(vsm): Generalize this code.
1281 if 'SourceInfo' in type_name: 1281 if 'SourceInfo' in type_name:
1282 type_data.native_type = 'const Vector<RefPtr<SourceInfo> >& ' 1282 type_data.native_type = 'const Vector<RefPtr<SourceInfo> >& '
1283 return SequenceIDLTypeInfo(type_name, type_data, item_info) 1283 return SequenceIDLTypeInfo(type_name, type_data, item_info)
1284 1284
1285 if not type_name in _idl_type_registry: 1285 if not type_name in _idl_type_registry:
1286 if self._database.HasEnum(type_name): 1286 if self._database.HasEnum(type_name):
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 if type_data.clazz == 'BasicTypedList': 1323 if type_data.clazz == 'BasicTypedList':
1324 if type_name == 'ArrayBuffer': 1324 if type_name == 'ArrayBuffer':
1325 dart_interface_name = 'ByteBuffer' 1325 dart_interface_name = 'ByteBuffer'
1326 else: 1326 else:
1327 dart_interface_name = self._renamer.RenameInterfaceId(type_name) 1327 dart_interface_name = self._renamer.RenameInterfaceId(type_name)
1328 return BasicTypedListIDLTypeInfo( 1328 return BasicTypedListIDLTypeInfo(
1329 type_name, type_data, dart_interface_name, self) 1329 type_name, type_data, dart_interface_name, self)
1330 1330
1331 class_name = '%sIDLTypeInfo' % type_data.clazz 1331 class_name = '%sIDLTypeInfo' % type_data.clazz
1332 return globals()[class_name](type_name, type_data) 1332 return globals()[class_name](type_name, type_data)
OLDNEW
« no previous file with comments | « dart/tools/dom/scripts/dartgenerator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698