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

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

Issue 10831035: Refactor conversion to native. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/dom/scripts/generator.py ('k') | 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 0b1979d5743cff49656d1e67fc874e576336cc6d..ed0b0ba54aa4a33a5d6d562e894b77ba7bad4d3e 100644
--- a/lib/dom/scripts/systemnative.py
+++ b/lib/dom/scripts/systemnative.py
@@ -830,16 +830,25 @@ class NativeImplementationGenerator(systembase.BaseGenerator):
# Emit arguments.
start_index = 1 if needs_receiver else 0
for i, argument in enumerate(arguments):
- type_info = self._TypeInfo(argument.type.id)
- self._cpp_impl_includes |= set(type_info.to_native_includes())
argument_name = DartDomNameOfAttribute(argument)
- type_info.emit_to_native(
- body_emitter,
+ argument_expression, type, cls, function = self._TypeInfo(argument.type.id).to_native_info(
argument,
(IsOptional(argument) and not self._IsArgumentOptionalInWebCore(node, argument)) or (argument.ext_attrs.get('Optional') == 'DefaultIsNullString'),
argument_name,
- 'Dart_GetNativeArgument(args, %i)' % (start_index + i))
- cpp_arguments.append(type_info.argument_expression(argument_name, self._interface.id))
+ self._interface.id)
+
+ body_emitter.Emit(
+ '\n'
+ ' $TYPE $ARGUMENT_NAME = $CLS::$FUNCTION(Dart_GetNativeArgument(args, $INDEX), exception);\n'
+ ' if (exception)\n'
+ ' goto fail;\n',
+ TYPE=type,
+ ARGUMENT_NAME=argument_name,
+ CLS=cls,
+ FUNCTION=function,
+ INDEX=start_index + i)
+ self._cpp_impl_includes.add('"%s.h"' % cls)
+ cpp_arguments.append(argument_expression)
body_emitter.Emit('\n')
« 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