Chromium Code Reviews| 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 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 730 def dart_type(self): | 730 def dart_type(self): |
| 731 return self._data.dart_type or self._dart_interface_name | 731 return self._data.dart_type or self._dart_interface_name |
| 732 | 732 |
| 733 def narrow_dart_type(self): | 733 def narrow_dart_type(self): |
| 734 # TODO(podivilov): only primitive and collection types should override | 734 # TODO(podivilov): only primitive and collection types should override |
| 735 # dart_type. | 735 # dart_type. |
| 736 if self._data.dart_type != None: | 736 if self._data.dart_type != None: |
| 737 return self.dart_type() | 737 return self.dart_type() |
| 738 if IsPureInterface(self.idl_type()): | 738 if IsPureInterface(self.idl_type()): |
| 739 return self.idl_type() | 739 return self.idl_type() |
| 740 return self.implementation_name() | 740 return ImplementationClassNameForInterfaceName(self.interface_name()) |
|
Anton Muhin
2012/10/12 17:50:42
why this has changed?
podivilov
2012/10/17 12:57:45
Implementation class name for HTMLElement is _Elem
| |
| 741 | 741 |
| 742 def interface_name(self): | 742 def interface_name(self): |
| 743 return self._dart_interface_name | 743 return self._dart_interface_name |
| 744 | 744 |
| 745 def implementation_name(self): | 745 def implementation_name(self): |
| 746 return ImplementationClassNameForInterfaceName(self._dart_interface_name) | 746 implementation_name = ImplementationClassNameForInterfaceName( |
| 747 self.interface_name()) | |
| 748 if self.merged_into(): | |
| 749 implementation_name = '%s_Merged' % implementation_name | |
| 750 return implementation_name | |
| 747 | 751 |
| 748 def has_generated_interface(self): | 752 def has_generated_interface(self): |
| 749 return True | 753 return True |
| 750 | 754 |
| 751 def merged_interface(self): | 755 def merged_interface(self): |
| 752 # All constants, attributes, and operations of merged interface should be | 756 # All constants, attributes, and operations of merged interface should be |
| 753 # added to this interface. Merged idl interface does not have corresponding | 757 # added to this interface. Merged idl interface does not have corresponding |
| 754 # Dart generated interface, and all references to merged idl interface | 758 # Dart generated interface, and all references to merged idl interface |
| 755 # (e.g. parameter types, return types, parent interfaces) should be replaced | 759 # (e.g. parameter types, return types, parent interfaces) should be replaced |
| 756 # with this interface. There are two important restrictions: | 760 # with this interface. There are two important restrictions: |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1105 self._database.GetInterface(type_name)) | 1109 self._database.GetInterface(type_name)) |
| 1106 else: | 1110 else: |
| 1107 dart_interface_name = type_name | 1111 dart_interface_name = type_name |
| 1108 return InterfaceIDLTypeInfo(type_name, type_data, dart_interface_name) | 1112 return InterfaceIDLTypeInfo(type_name, type_data, dart_interface_name) |
| 1109 | 1113 |
| 1110 if type_data.clazz == 'ListLike': | 1114 if type_data.clazz == 'ListLike': |
| 1111 return ListLikeIDLTypeInfo(type_name, type_data, self.TypeInfo(type_data.i tem_type)) | 1115 return ListLikeIDLTypeInfo(type_name, type_data, self.TypeInfo(type_data.i tem_type)) |
| 1112 | 1116 |
| 1113 class_name = '%sIDLTypeInfo' % type_data.clazz | 1117 class_name = '%sIDLTypeInfo' % type_data.clazz |
| 1114 return globals()[class_name](type_name, type_data) | 1118 return globals()[class_name](type_name, type_data) |
| OLD | NEW |