| 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 re | 10 import re |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 def dart_type(self): | 711 def dart_type(self): |
| 712 return self._data.dart_type or self._dart_interface_name | 712 return self._data.dart_type or self._dart_interface_name |
| 713 | 713 |
| 714 def narrow_dart_type(self): | 714 def narrow_dart_type(self): |
| 715 # TODO(podivilov): only primitive and collection types should override | 715 # TODO(podivilov): only primitive and collection types should override |
| 716 # dart_type. | 716 # dart_type. |
| 717 if self._data.dart_type != None: | 717 if self._data.dart_type != None: |
| 718 return self.dart_type() | 718 return self.dart_type() |
| 719 if IsPureInterface(self.idl_type()): | 719 if IsPureInterface(self.idl_type()): |
| 720 return self.idl_type() | 720 return self.idl_type() |
| 721 return self.implementation_name() | 721 return ImplementationClassNameForInterfaceName(self.interface_name()) |
| 722 | 722 |
| 723 def interface_name(self): | 723 def interface_name(self): |
| 724 return self._dart_interface_name | 724 return self._dart_interface_name |
| 725 | 725 |
| 726 def implementation_name(self): | 726 def implementation_name(self): |
| 727 return ImplementationClassNameForInterfaceName(self._dart_interface_name) | 727 implementation_name = ImplementationClassNameForInterfaceName( |
| 728 self.interface_name()) |
| 729 if self.merged_into(): |
| 730 implementation_name = '%s_Merged' % implementation_name |
| 731 return implementation_name |
| 728 | 732 |
| 729 def has_generated_interface(self): | 733 def has_generated_interface(self): |
| 730 return True | 734 return True |
| 731 | 735 |
| 732 def merged_interface(self): | 736 def merged_interface(self): |
| 733 # All constants, attributes, and operations of merged interface should be | 737 # All constants, attributes, and operations of merged interface should be |
| 734 # added to this interface. Merged idl interface does not have corresponding | 738 # added to this interface. Merged idl interface does not have corresponding |
| 735 # Dart generated interface, and all references to merged idl interface | 739 # Dart generated interface, and all references to merged idl interface |
| 736 # (e.g. parameter types, return types, parent interfaces) should be replaced | 740 # (e.g. parameter types, return types, parent interfaces) should be replaced |
| 737 # with this interface. There are two important restrictions: | 741 # with this interface. There are two important restrictions: |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 self._database.GetInterface(type_name)) | 1091 self._database.GetInterface(type_name)) |
| 1088 else: | 1092 else: |
| 1089 dart_interface_name = type_name | 1093 dart_interface_name = type_name |
| 1090 return InterfaceIDLTypeInfo(type_name, type_data, dart_interface_name) | 1094 return InterfaceIDLTypeInfo(type_name, type_data, dart_interface_name) |
| 1091 | 1095 |
| 1092 if type_data.clazz == 'ListLike': | 1096 if type_data.clazz == 'ListLike': |
| 1093 return ListLikeIDLTypeInfo(type_name, type_data, self.TypeInfo(type_data.i
tem_type)) | 1097 return ListLikeIDLTypeInfo(type_name, type_data, self.TypeInfo(type_data.i
tem_type)) |
| 1094 | 1098 |
| 1095 class_name = '%sIDLTypeInfo' % type_data.clazz | 1099 class_name = '%sIDLTypeInfo' % type_data.clazz |
| 1096 return globals()[class_name](type_name, type_data) | 1100 return globals()[class_name](type_name, type_data) |
| OLD | NEW |