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

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

Issue 10827046: Split to dart conversion and argument expression logic. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | « lib/dom/scripts/generator.py ('k') | no next file » | 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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 ' RefPtr<ScriptCallStack> scriptCallStack(DartUtilities::create ScriptCallStack());\n' 795 ' RefPtr<ScriptCallStack> scriptCallStack(DartUtilities::create ScriptCallStack());\n'
796 ' if (!scriptCallStack->size())\n' 796 ' if (!scriptCallStack->size())\n'
797 ' return;\n', 797 ' return;\n',
798 INDEX=len(arguments) + 1) 798 INDEX=len(arguments) + 1)
799 799
800 # Emit arguments. 800 # Emit arguments.
801 start_index = 1 if needs_receiver else 0 801 start_index = 1 if needs_receiver else 0
802 for i, argument in enumerate(arguments): 802 for i, argument in enumerate(arguments):
803 type_info = self._TypeInfo(argument.type.id) 803 type_info = self._TypeInfo(argument.type.id)
804 self._cpp_impl_includes |= set(type_info.to_native_includes()) 804 self._cpp_impl_includes |= set(type_info.to_native_includes())
805 cpp_arguments.append(type_info.emit_to_native( 805 argument_name = DartDomNameOfAttribute(argument)
806 type_info.emit_to_native(
806 body_emitter, 807 body_emitter,
807 argument, 808 argument,
808 (IsOptional(argument) and not self._IsArgumentOptionalInWebCore(node, argument)) or (argument.ext_attrs.get('Optional') == 'DefaultIsNullString'), 809 (IsOptional(argument) and not self._IsArgumentOptionalInWebCore(node, argument)) or (argument.ext_attrs.get('Optional') == 'DefaultIsNullString'),
809 # TODO(antonm): all IDs should be renamed when database is generated. 810 argument_name,
810 # That will allow to get rid of argument_name argument altogether. 811 'Dart_GetNativeArgument(args, %i)' % (start_index + i))
811 DartDomNameOfAttribute(argument), 812 cpp_arguments.append(type_info.argument_expression(argument_name, self._in terface.id))
812 'Dart_GetNativeArgument(args, %i)' % (start_index + i),
813 self._interface.id))
814 813
815 body_emitter.Emit('\n') 814 body_emitter.Emit('\n')
816 815
817 if 'NeedsUserGestureCheck' in ext_attrs: 816 if 'NeedsUserGestureCheck' in ext_attrs:
818 cpp_arguments.append('DartUtilities::processingUserGesture'); 817 cpp_arguments.append('DartUtilities::processingUserGesture');
819 818
820 invocation_emitter = body_emitter 819 invocation_emitter = body_emitter
821 if raises_dom_exception: 820 if raises_dom_exception:
822 cpp_arguments.append('ec') 821 cpp_arguments.append('ec')
823 invocation_emitter = body_emitter.Emit( 822 invocation_emitter = body_emitter.Emit(
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 parent_interface = _FindInHierarchy(database, parent_interface, test) 919 parent_interface = _FindInHierarchy(database, parent_interface, test)
921 if parent_interface: 920 if parent_interface:
922 return parent_interface 921 return parent_interface
923 922
924 def _ToWebKitName(name): 923 def _ToWebKitName(name):
925 name = name[0].lower() + name[1:] 924 name = name[0].lower() + name[1:]
926 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), 925 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(),
927 name) 926 name)
928 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize() , 927 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize() ,
929 name) 928 name)
OLDNEW
« no previous file with comments | « lib/dom/scripts/generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698