OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # | 2 # |
3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
6 | 6 |
7 """Generates sdk/lib/_blink/dartium/_blink_dartium.dart file.""" | 7 """Generates sdk/lib/_blink/dartium/_blink_dartium.dart file.""" |
8 | 8 |
9 import os | 9 import os |
10 | 10 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 if argument.is_optional: | 184 if argument.is_optional: |
185 optional_default_args += 1 | 185 optional_default_args += 1 |
186 | 186 |
187 arg_count = len(param_infos) | 187 arg_count = len(param_infos) |
188 min_arg_count = arg_count - optional_default_args | 188 min_arg_count = arg_count - optional_default_args |
189 lb = min_arg_count - 2 if min_arg_count > 2 else 0 | 189 lb = min_arg_count - 2 if min_arg_count > 2 else 0 |
190 return (lb, arg_count + 1) | 190 return (lb, arg_count + 1) |
191 | 191 |
192 constructor_renames = { | 192 constructor_renames = { |
193 'RTCPeerConnection': 'webkitRTCPeerConnection', | 193 'RTCPeerConnection': 'webkitRTCPeerConnection', |
| 194 'SpeechRecognition': 'webkitSpeechRecognition', |
194 } | 195 } |
195 | 196 |
196 def rename_constructor(name): | 197 def rename_constructor(name): |
197 return constructor_renames[name] if name in constructor_renames else name | 198 return constructor_renames[name] if name in constructor_renames else name |
198 | 199 |
199 def Generate_Blink(output_dir, database, type_registry): | 200 def Generate_Blink(output_dir, database, type_registry): |
200 blink_filename = os.path.join(output_dir, '_blink_dartium.dart') | 201 blink_filename = os.path.join(output_dir, '_blink_dartium.dart') |
201 blink_file = open(blink_filename, 'w') | 202 blink_file = open(blink_filename, 'w') |
202 | 203 |
203 blink_file.write(HEADER); | 204 blink_file.write(HEADER); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 else: | 322 else: |
322 arguments = [] | 323 arguments = [] |
323 for i in range(0, callback_index): | 324 for i in range(0, callback_index): |
324 arguments.append(ARGUMENT_NUM % i) | 325 arguments.append(ARGUMENT_NUM % i) |
325 argument_list = ', '.join(arguments) | 326 argument_list = ', '.join(arguments) |
326 if operation.is_static: | 327 if operation.is_static: |
327 class_property = CLASS_STATIC % interface.id | 328 class_property = CLASS_STATIC % interface.id |
328 blink_file.write(STATIC_OPERATION_ARGS % (name, callback_index, argument
_list, class_property, name, argument_list)) | 329 blink_file.write(STATIC_OPERATION_ARGS % (name, callback_index, argument
_list, class_property, name, argument_list)) |
329 else: | 330 else: |
330 blink_file.write(OPERATION_ARGS % (name, callback_index, argument_list,
name, argument_list)) | 331 blink_file.write(OPERATION_ARGS % (name, callback_index, argument_list,
name, argument_list)) |
OLD | NEW |