OLD | NEW |
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 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 if 'SourceInfo' in type_name: | 1299 if 'SourceInfo' in type_name: |
1300 type_data.native_type = 'const Vector<RefPtr<SourceInfo> >& ' | 1300 type_data.native_type = 'const Vector<RefPtr<SourceInfo> >& ' |
1301 return SequenceIDLTypeInfo(type_name, type_data, item_info) | 1301 return SequenceIDLTypeInfo(type_name, type_data, item_info) |
1302 | 1302 |
1303 if not type_name in _idl_type_registry: | 1303 if not type_name in _idl_type_registry: |
1304 if self._database.HasEnum(type_name): | 1304 if self._database.HasEnum(type_name): |
1305 return PrimitiveIDLTypeInfo( | 1305 return PrimitiveIDLTypeInfo( |
1306 type_name, | 1306 type_name, |
1307 TypeData(clazz='Primitive', dart_type='String', native_type='String'
)) | 1307 TypeData(clazz='Primitive', dart_type='String', native_type='String'
)) |
1308 | 1308 |
1309 interface = self._database.GetInterface(type_name) | 1309 if self._database.HasInterface(type_name): |
| 1310 interface = self._database.GetInterface(type_name) |
| 1311 else: |
| 1312 interface = self._database.GetDictionary(type_name) |
1310 if 'Callback' in interface.ext_attrs: | 1313 if 'Callback' in interface.ext_attrs: |
1311 return CallbackIDLTypeInfo(type_name, TypeData('Callback', | 1314 return CallbackIDLTypeInfo(type_name, TypeData('Callback', |
1312 self._renamer.DartifyTypeName(type_name))) | 1315 self._renamer.DartifyTypeName(type_name))) |
1313 return InterfaceIDLTypeInfo( | 1316 return InterfaceIDLTypeInfo( |
1314 type_name, | 1317 type_name, |
1315 TypeData('Interface'), | 1318 TypeData('Interface'), |
1316 self._renamer.RenameInterface(interface), | 1319 self._renamer.RenameInterface(interface), |
1317 self) | 1320 self) |
1318 | 1321 |
1319 type_data = _idl_type_registry.get(type_name) | 1322 type_data = _idl_type_registry.get(type_name) |
(...skipping 21 matching lines...) Expand all Loading... |
1341 if type_data.clazz == 'BasicTypedList': | 1344 if type_data.clazz == 'BasicTypedList': |
1342 if type_name == 'ArrayBuffer': | 1345 if type_name == 'ArrayBuffer': |
1343 dart_interface_name = 'ByteBuffer' | 1346 dart_interface_name = 'ByteBuffer' |
1344 else: | 1347 else: |
1345 dart_interface_name = self._renamer.RenameInterfaceId(type_name) | 1348 dart_interface_name = self._renamer.RenameInterfaceId(type_name) |
1346 return BasicTypedListIDLTypeInfo( | 1349 return BasicTypedListIDLTypeInfo( |
1347 type_name, type_data, dart_interface_name, self) | 1350 type_name, type_data, dart_interface_name, self) |
1348 | 1351 |
1349 class_name = '%sIDLTypeInfo' % type_data.clazz | 1352 class_name = '%sIDLTypeInfo' % type_data.clazz |
1350 return globals()[class_name](type_name, type_data) | 1353 return globals()[class_name](type_name, type_data) |
OLD | NEW |