Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: sdk/lib/html/scripts/systemnative.py

Issue 11644103: Adding types to dart:html's dartium files where possible. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 systems to generate 6 """This module provides shared functionality for the systems to generate
7 native binding from the IDL database.""" 7 native binding from the IDL database."""
8 8
9 import emitter 9 import emitter
10 import os 10 import os
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 dart_declaration = 'void operator[]=(int index, %s value)' % element_type 426 dart_declaration = 'void operator[]=(int index, %s value)' % element_type
427 self._GenerateNativeBinding('numericIndexSetter', 3, dart_declaration, 427 self._GenerateNativeBinding('numericIndexSetter', 3, dart_declaration,
428 'Callback', True) 428 'Callback', True)
429 429
430 def EmitOperation(self, info, html_name): 430 def EmitOperation(self, info, html_name):
431 """ 431 """
432 Arguments: 432 Arguments:
433 info: An OperationInfo object. 433 info: An OperationInfo object.
434 """ 434 """
435 435
436 operation = info.operations[0] 436 operation = info.operations[0]
Anton Muhin 2012/12/28 10:21:02 please, move all those assignments below dart_decl
blois 2013/01/14 22:32:52 Done.
437 437
438 is_custom = 'Custom' in operation.ext_attrs 438 is_custom = 'Custom' in operation.ext_attrs
439 has_optional_arguments = any(self._IsArgumentOptionalInWebCore(operation, ar gument) for argument in operation.arguments) 439 has_optional_arguments = any(self._IsArgumentOptionalInWebCore(operation, ar gument) for argument in operation.arguments)
440 needs_dispatcher = not is_custom and (len(info.operations) > 1 or has_option al_arguments) 440 needs_dispatcher = not is_custom and (len(info.operations) > 1 or has_option al_arguments)
441 441
442 dart_declaration = '%s%s %s(%s)' % ( 442 dart_declaration = '%s%s %s(%s)' % (
443 'static ' if info.IsStatic() else '', 443 'static ' if info.IsStatic() else '',
444 self.SecureOutputType(info.type_name), 444 self.SecureOutputType(info.type_name),
445 html_name, 445 html_name,
446 info.ParametersDeclaration( 446 info.ParametersDeclaration(self._DartType))
447 (lambda x: 'dynamic') if needs_dispatcher else self._DartType))
Anton Muhin 2012/12/28 10:21:02 do we need TypeOrNothings logic in .ParametersDecl
blois 2013/01/14 22:32:52 There are still some types which we don't have in
448 447
449 if not needs_dispatcher: 448 if not needs_dispatcher:
450 # Bind directly to native implementation 449 # Bind directly to native implementation
451 argument_count = (0 if info.IsStatic() else 1) + len(info.param_infos) 450 argument_count = (0 if info.IsStatic() else 1) + len(info.param_infos)
452 cpp_callback_name = self._GenerateNativeBinding( 451 cpp_callback_name = self._GenerateNativeBinding(
453 info.name, argument_count, dart_declaration, 'Callback', is_custom) 452 info.name, argument_count, dart_declaration, 'Callback', is_custom)
454 if not is_custom: 453 if not is_custom:
455 self._GenerateOperationNativeCallback(operation, operation.arguments, cp p_callback_name) 454 self._GenerateOperationNativeCallback(operation, operation.arguments, cp p_callback_name)
456 else: 455 else:
457 self._GenerateDispatcher(info.operations, dart_declaration, [info.name for info in info.param_infos]) 456 self._GenerateDispatcher(info.operations, dart_declaration, [info.name for info in info.param_infos])
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 LIBRARY_NAME=library_name) 910 LIBRARY_NAME=library_name)
912 911
913 headers = self._library_headers[library_name] 912 headers = self._library_headers[library_name]
914 for header_file in headers: 913 for header_file in headers:
915 path = os.path.relpath(header_file, output_dir) 914 path = os.path.relpath(header_file, output_dir)
916 includes_emitter.Emit('#include "$PATH"\n', PATH=path) 915 includes_emitter.Emit('#include "$PATH"\n', PATH=path)
917 body_emitter.Emit( 916 body_emitter.Emit(
918 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n' 917 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n'
919 ' return func;\n', 918 ' return func;\n',
920 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 919 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/indexed_db/dartium/indexed_db_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698