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

Side by Side Diff: lib/dom/scripts/systemnative.py

Issue 10379010: Properly count number of arguments for statics. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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
« no previous file with comments | « no previous file | tests/dom/dom.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 info: An OperationInfo object. 569 info: An OperationInfo object.
570 """ 570 """
571 571
572 if 'CheckSecurityForNode' in info.overloads[0].ext_attrs: 572 if 'CheckSecurityForNode' in info.overloads[0].ext_attrs:
573 # FIXME: exclude from interface as well. 573 # FIXME: exclude from interface as well.
574 return 574 return
575 575
576 if 'Custom' in info.overloads[0].ext_attrs: 576 if 'Custom' in info.overloads[0].ext_attrs:
577 parameters = info.ParametersImplementationDeclaration() 577 parameters = info.ParametersImplementationDeclaration()
578 dart_declaration = '%s %s(%s)' % (info.type_name, info.name, parameters) 578 dart_declaration = '%s %s(%s)' % (info.type_name, info.name, parameters)
579 argument_count = 1 + len(info.param_infos) 579 argument_count = (0 if info.IsStatic() else 1) + len(info.param_infos)
580 self._GenerateNativeBinding(info.name, argument_count, dart_declaration, 580 self._GenerateNativeBinding(info.name, argument_count, dart_declaration,
581 'Callback', True) 581 'Callback', True)
582 return 582 return
583 583
584 modifier = '' 584 modifier = ''
585 if info.IsStatic(): 585 if info.IsStatic():
586 modifier = 'static ' 586 modifier = 'static '
587 body = self._members_emitter.Emit( 587 body = self._members_emitter.Emit(
588 '\n' 588 '\n'
589 ' $MODIFIER$TYPE $NAME($PARAMETERS) {\n' 589 ' $MODIFIER$TYPE $NAME($PARAMETERS) {\n'
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 NATIVENAME=native_name, 639 NATIVENAME=native_name,
640 ARGS=argument_list) 640 ARGS=argument_list)
641 # Generate binding. 641 # Generate binding.
642 modifier = '' 642 modifier = ''
643 if operation.is_static: 643 if operation.is_static:
644 modifier = 'static ' 644 modifier = 'static '
645 dart_declaration = '%s%s _%s(%s)' % (modifier, info.type_name, native_name, 645 dart_declaration = '%s%s _%s(%s)' % (modifier, info.type_name, native_name,
646 argument_list) 646 argument_list)
647 is_custom = 'Custom' in operation.ext_attrs 647 is_custom = 'Custom' in operation.ext_attrs
648 cpp_callback_name = self._GenerateNativeBinding( 648 cpp_callback_name = self._GenerateNativeBinding(
649 native_name, 1 + len(operation.arguments), dart_declaration, 'Callback', 649 native_name, (0 if operation.is_static else 1) + len(operation.arguments ), dart_declaration, 'Callback',
650 is_custom) 650 is_custom)
651 if is_custom: 651 if is_custom:
652 return 652 return
653 653
654 # Generate callback. 654 # Generate callback.
655 webcore_function_name = operation.ext_attrs.get('ImplementedAs', operation.i d) 655 webcore_function_name = operation.ext_attrs.get('ImplementedAs', operation.i d)
656 656
657 parameter_definitions_emitter = emitter.Emitter() 657 parameter_definitions_emitter = emitter.Emitter()
658 arguments = [] 658 arguments = []
659 raises_exceptions = self._GenerateCallWithHandling( 659 raises_exceptions = self._GenerateCallWithHandling(
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 def _InstanceOfNode(database, interface): 863 def _InstanceOfNode(database, interface):
864 if interface.id == 'Node': 864 if interface.id == 'Node':
865 return True 865 return True
866 for parent in interface.parents: 866 for parent in interface.parents:
867 if not database.HasInterface(parent.type.id): 867 if not database.HasInterface(parent.type.id):
868 continue 868 continue
869 parent_interface = database.GetInterface(parent.type.id) 869 parent_interface = database.GetInterface(parent.type.id)
870 if _InstanceOfNode(database, parent_interface): 870 if _InstanceOfNode(database, parent_interface):
871 return True 871 return True
872 return False 872 return False
OLDNEW
« no previous file with comments | « no previous file | tests/dom/dom.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698