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

Unified Diff: lib/dom/scripts/systemnative.py

Issue 10834008: Minor rework of argument emission. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/dom/scripts/systemnative.py
diff --git a/lib/dom/scripts/systemnative.py b/lib/dom/scripts/systemnative.py
index f410895e618cf3852b95956df674bd9254456fd5..c7b7164464faa9cd668b9a2851302f1c55586c5e 100644
--- a/lib/dom/scripts/systemnative.py
+++ b/lib/dom/scripts/systemnative.py
@@ -797,11 +797,19 @@ class NativeImplementationGenerator(systembase.BaseGenerator):
' return;\n',
INDEX=len(arguments) + 1)
- # Process Dart cpp_arguments.
+ # Emit arguments.
start_index = 1 if needs_receiver else 0
for i, argument in enumerate(arguments):
- argument_expression = self._GenerateToNative(body_emitter, argument, start_index + i)
- cpp_arguments.append(argument_expression)
+ type_info = self._TypeInfo(argument.type.id)
+ self._cpp_impl_includes |= set(type_info.to_native_includes())
+ cpp_arguments.append(type_info.emit_to_native(
+ body_emitter,
+ argument,
+ # TODO(antonm): all IDs should be renamed when database is generated.
+ # That will allow to get rid of argument_name argument altogether.
+ DartDomNameOfAttribute(argument),
+ 'Dart_GetNativeArgument(args, %i)' % (start_index + i),
+ self._interface.id))
body_emitter.Emit('\n')
@@ -849,19 +857,6 @@ class NativeImplementationGenerator(systembase.BaseGenerator):
' Dart_SetReturnValue(args, returnValue);\n',
TO_DART_CONVERSION=to_dart_conversion)
- def _GenerateToNative(self, emitter, idl_node, index):
- """idl_node is IDLArgument or IDLAttribute."""
- type_info = self._TypeInfo(idl_node.type.id)
- self._cpp_impl_includes |= set(type_info.to_native_includes())
- argument_name = idl_node.id
- # Rename to get rid of conflicts with C++ keywords.
- if argument_name == 'default':
- argument_name = 'value'
- handle = 'Dart_GetNativeArgument(args, %i)' % index
- argument_expression = type_info.emit_to_native(
- emitter, idl_node, argument_name, handle, self._interface.id)
- return argument_expression
-
def _GenerateNativeBinding(self, idl_name, argument_count, dart_declaration,
native_suffix, is_custom):
native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698