| 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 19 matching lines...) Expand all Loading... |
| 30 'SVGTests', | 30 'SVGTests', |
| 31 'SVGTransformable', | 31 'SVGTransformable', |
| 32 'SVGURIReference', | 32 'SVGURIReference', |
| 33 'SVGZoomAndPan', | 33 'SVGZoomAndPan', |
| 34 'TimeoutHandler', | 34 'TimeoutHandler', |
| 35 ]) | 35 ]) |
| 36 | 36 |
| 37 def IsPureInterface(interface_name): | 37 def IsPureInterface(interface_name): |
| 38 return interface_name in _pure_interfaces | 38 return interface_name in _pure_interfaces |
| 39 | 39 |
| 40 # |
| 41 # Classes which have native constructors but which we are suppressing because |
| 42 # they are not cross-platform. |
| 43 # |
| 44 _suppressed_native_constructors = monitored.Set( |
| 45 'generator._suppressed_native_constructors', [ |
| 46 'DocumentFragment', |
| 47 'Range', |
| 48 'Text', |
| 49 ]) |
| 50 |
| 40 _custom_types = monitored.Set('generator._custom_types', | 51 _custom_types = monitored.Set('generator._custom_types', |
| 41 typed_array_renames.keys()) | 52 typed_array_renames.keys()) |
| 42 | 53 |
| 43 def IsCustomType(interface_name): | 54 def IsCustomType(interface_name): |
| 44 return interface_name in _custom_types | 55 return interface_name in _custom_types |
| 45 | 56 |
| 46 _methods_with_named_formals = monitored.Set( | 57 _methods_with_named_formals = monitored.Set( |
| 47 'generator._methods_with_named_formals', [ | 58 'generator._methods_with_named_formals', [ |
| 48 'DirectoryEntry.getDirectory', | 59 'DirectoryEntry.getDirectory', |
| 49 'DirectoryEntry.getFile', | 60 'DirectoryEntry.getFile', |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 new_info.type_name = 'Future' | 246 new_info.type_name = 'Future' |
| 236 | 247 |
| 237 return new_info | 248 return new_info |
| 238 | 249 |
| 239 | 250 |
| 240 def AnalyzeConstructor(interface): | 251 def AnalyzeConstructor(interface): |
| 241 """Returns an OperationInfo object for the constructor. | 252 """Returns an OperationInfo object for the constructor. |
| 242 | 253 |
| 243 Returns None if the interface has no Constructor. | 254 Returns None if the interface has no Constructor. |
| 244 """ | 255 """ |
| 256 if interface.id in _suppressed_native_constructors: |
| 257 return None |
| 258 |
| 245 if 'Constructor' in interface.ext_attrs: | 259 if 'Constructor' in interface.ext_attrs: |
| 246 name = None | 260 name = None |
| 247 overloads = interface.ext_attrs['Constructor'] | 261 overloads = interface.ext_attrs['Constructor'] |
| 248 idl_args = [[] if f is None else f.arguments for f in overloads] | 262 idl_args = [[] if f is None else f.arguments for f in overloads] |
| 249 elif 'NamedConstructor' in interface.ext_attrs: | 263 elif 'NamedConstructor' in interface.ext_attrs: |
| 250 func_value = interface.ext_attrs.get('NamedConstructor') | 264 func_value = interface.ext_attrs.get('NamedConstructor') |
| 251 idl_args = [func_value.arguments] | 265 idl_args = [func_value.arguments] |
| 252 name = func_value.id | 266 name = func_value.id |
| 253 else: | 267 else: |
| 254 return None | 268 return None |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 type_name, type_data, dart_interface_name, self) | 1141 type_name, type_data, dart_interface_name, self) |
| 1128 | 1142 |
| 1129 if type_data.clazz == 'BasicTypedList': | 1143 if type_data.clazz == 'BasicTypedList': |
| 1130 dart_interface_name = self._renamer.RenameInterface( | 1144 dart_interface_name = self._renamer.RenameInterface( |
| 1131 self._database.GetInterface(type_name)) | 1145 self._database.GetInterface(type_name)) |
| 1132 return BasicTypedListIDLTypeInfo( | 1146 return BasicTypedListIDLTypeInfo( |
| 1133 type_name, type_data, dart_interface_name, self) | 1147 type_name, type_data, dart_interface_name, self) |
| 1134 | 1148 |
| 1135 class_name = '%sIDLTypeInfo' % type_data.clazz | 1149 class_name = '%sIDLTypeInfo' % type_data.clazz |
| 1136 return globals()[class_name](type_name, type_data) | 1150 return globals()[class_name](type_name, type_data) |
| OLD | NEW |