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 the system to generate | 6 """This module provides shared functionality for the system to generate |
7 Dart:html APIs from the IDL database.""" | 7 Dart:html APIs from the IDL database.""" |
8 | 8 |
9 import emitter | 9 import emitter |
10 import logging | 10 import logging |
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 return re.search('^@.*Returns', ann) or re.search('^@.*Creates', ann) | 1138 return re.search('^@.*Returns', ann) or re.search('^@.*Creates', ann) |
1139 if not filter(js_type_annotation, anns): | 1139 if not filter(js_type_annotation, anns): |
1140 _logger.warn('Member with wildcard native type: %s.%s' % | 1140 _logger.warn('Member with wildcard native type: %s.%s' % |
1141 (self._interface.id, idl_member_name)) | 1141 (self._interface.id, idl_member_name)) |
1142 | 1142 |
1143 return self._metadata.FormatMetadata(anns, indent); | 1143 return self._metadata.FormatMetadata(anns, indent); |
1144 | 1144 |
1145 def CustomJSMembers(self): | 1145 def CustomJSMembers(self): |
1146 return _js_custom_members | 1146 return _js_custom_members |
1147 | 1147 |
1148 def _NarrowToImplementationType(self, type_name): | |
1149 return self._type_registry.TypeInfo(type_name).narrow_dart_type() | |
1150 | |
1151 def _NarrowInputType(self, type_name): | |
1152 return self._NarrowToImplementationType(type_name) | |
1153 | |
1154 def _FindShadowedAttribute(self, attr): | 1148 def _FindShadowedAttribute(self, attr): |
1155 """Returns (attribute, superinterface) or (None, None).""" | 1149 """Returns (attribute, superinterface) or (None, None).""" |
1156 def FindInParent(interface): | 1150 def FindInParent(interface): |
1157 """Returns matching attribute in parent, or None.""" | 1151 """Returns matching attribute in parent, or None.""" |
1158 if interface.parents: | 1152 if interface.parents: |
1159 parent = interface.parents[0] | 1153 parent = interface.parents[0] |
1160 if IsDartCollectionType(parent.type.id): | 1154 if IsDartCollectionType(parent.type.id): |
1161 return (None, None) | 1155 return (None, None) |
1162 if IsPureInterface(parent.type.id): | 1156 if IsPureInterface(parent.type.id): |
1163 return (None, None) | 1157 return (None, None) |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 | 1266 |
1273 def AddFile(self, basename, library_name, path): | 1267 def AddFile(self, basename, library_name, path): |
1274 self._libraries[library_name].AddFile(path) | 1268 self._libraries[library_name].AddFile(path) |
1275 | 1269 |
1276 def AddTypeEntry(self, library_name, idl_name, dart_name): | 1270 def AddTypeEntry(self, library_name, idl_name, dart_name): |
1277 self._libraries[library_name].AddTypeEntry(idl_name, dart_name) | 1271 self._libraries[library_name].AddTypeEntry(idl_name, dart_name) |
1278 | 1272 |
1279 def Emit(self, emitter, auxiliary_dir): | 1273 def Emit(self, emitter, auxiliary_dir): |
1280 for lib in self._libraries.values(): | 1274 for lib in self._libraries.values(): |
1281 lib.Emit(emitter, auxiliary_dir) | 1275 lib.Emit(emitter, auxiliary_dir) |
OLD | NEW |