| 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 |
| 11 import monitored | 11 import monitored |
| 12 import os | 12 import os |
| 13 import re | 13 import re |
| 14 from htmlrenamer import html_interface_renames, typed_array_renames | 14 from htmlrenamer import custom_html_constructors, html_interface_renames, \ |
| 15 typed_array_renames |
| 15 | 16 |
| 16 _pure_interfaces = monitored.Set('generator._pure_interfaces', [ | 17 _pure_interfaces = monitored.Set('generator._pure_interfaces', [ |
| 17 # TODO(sra): DOMStringMap should be a class implementing Map<String,String>. | 18 # TODO(sra): DOMStringMap should be a class implementing Map<String,String>. |
| 18 'DOMStringMap', | 19 'DOMStringMap', |
| 19 'ChildNode', | 20 'ChildNode', |
| 20 'EventListener', | 21 'EventListener', |
| 21 'MediaQueryListListener', | 22 'MediaQueryListListener', |
| 22 'MutationCallback', | 23 'MutationCallback', |
| 23 'NavigatorID', | 24 'NavigatorID', |
| 24 'NavigatorOnLine', | 25 'NavigatorOnLine', |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 idl_args = [func_value.arguments] | 307 idl_args = [func_value.arguments] |
| 307 name = func_value.id | 308 name = func_value.id |
| 308 else: | 309 else: |
| 309 return None | 310 return None |
| 310 | 311 |
| 311 info = OperationInfo() | 312 info = OperationInfo() |
| 312 info.overloads = None | 313 info.overloads = None |
| 313 info.idl_args = idl_args | 314 info.idl_args = idl_args |
| 314 info.declared_name = name | 315 info.declared_name = name |
| 315 info.name = name | 316 info.name = name |
| 316 info.constructor_name = None | 317 info.constructor_name = ('_' if interface.id in custom_html_constructors |
| 318 else None) |
| 317 info.js_name = name | 319 info.js_name = name |
| 318 info.type_name = interface.id | 320 info.type_name = interface.id |
| 319 info.param_infos = _BuildArguments(idl_args, interface, constructor=True) | 321 info.param_infos = _BuildArguments(idl_args, interface, constructor=True) |
| 320 info.requires_named_arguments = False | 322 info.requires_named_arguments = False |
| 321 info.pure_dart_constructor = False | 323 info.pure_dart_constructor = False |
| 322 return info | 324 return info |
| 323 | 325 |
| 324 def IsDartListType(type): | 326 def IsDartListType(type): |
| 325 return type == 'List' or type.startswith('sequence<') | 327 return type == 'List' or type.startswith('sequence<') |
| 326 | 328 |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 if type_data.clazz == 'BasicTypedList': | 1241 if type_data.clazz == 'BasicTypedList': |
| 1240 if type_name == 'ArrayBuffer': | 1242 if type_name == 'ArrayBuffer': |
| 1241 dart_interface_name = 'ByteBuffer' | 1243 dart_interface_name = 'ByteBuffer' |
| 1242 else: | 1244 else: |
| 1243 dart_interface_name = self._renamer.RenameInterfaceId(type_name) | 1245 dart_interface_name = self._renamer.RenameInterfaceId(type_name) |
| 1244 return BasicTypedListIDLTypeInfo( | 1246 return BasicTypedListIDLTypeInfo( |
| 1245 type_name, type_data, dart_interface_name, self) | 1247 type_name, type_data, dart_interface_name, self) |
| 1246 | 1248 |
| 1247 class_name = '%sIDLTypeInfo' % type_data.clazz | 1249 class_name = '%sIDLTypeInfo' % type_data.clazz |
| 1248 return globals()[class_name](type_name, type_data) | 1250 return globals()[class_name](type_name, type_data) |
| OLD | NEW |