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

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

Issue 10657047: Stop using ParameterAdapter<String> in generated code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 | lib/dom/templates/dom/native/cpp_implementation.template » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/dom/scripts/generator.py
diff --git a/lib/dom/scripts/generator.py b/lib/dom/scripts/generator.py
index f84b972a837a69fcab1576d260ec148f14247d81..e0c7b552f16dc2de2f21f877f5edbdcca1f097d3 100644
--- a/lib/dom/scripts/generator.py
+++ b/lib/dom/scripts/generator.py
@@ -655,31 +655,23 @@ class PrimitiveIDLTypeInfo(IDLTypeInfo):
self._webcore_setter_name = webcore_setter_name
def emit_to_native(self, emitter, idl_node, name, handle, interface_name):
- if self.native_type() == 'String':
- arguments = [handle]
- if idl_node.ext_attrs.get('Optional') == 'DefaultIsNullString':
- arguments.append('DartUtilities::ConvertNullToDefaultValue')
- emitter.Emit(
- ' const ParameterAdapter<String> $NAME($ARGUMENTS);\n'
- ' if (!$NAME.conversionSuccessful()) {\n'
- ' exception = $NAME.exception();\n'
- ' goto fail;\n'
- ' }\n',
- NAME=name,
- ARGUMENTS=', '.join(arguments))
- else:
- type = self.native_type()
- if type == 'SerializedScriptValue':
- type = 'RefPtr<%s>' % type
- emitter.Emit(
- '\n'
- ' $TYPE $NAME = DartUtilities::dartTo$CAPITALIZED_TYPE($HANDLE, exception);\n'
- ' if (exception)\n'
- ' goto fail;\n',
- TYPE=type,
- NAME=name,
- CAPITALIZED_TYPE=self._capitalized_native_type(),
- HANDLE=handle)
+ function_name = 'dartTo%s' % self._capitalized_native_type()
+ if idl_node.ext_attrs.get('Optional') == 'DefaultIsNullString':
+ function_name += 'WithNullCheck'
+ type = self.native_type()
+ if type == 'SerializedScriptValue':
+ type = 'RefPtr<%s>' % type
+ if type == 'String':
+ type = 'DartStringAdapter'
+ emitter.Emit(
+ '\n'
+ ' $TYPE $NAME = DartUtilities::$FUNCTION_NAME($HANDLE, exception);\n'
+ ' if (exception)\n'
+ ' goto fail;\n',
+ TYPE=type,
+ NAME=name,
+ FUNCTION_NAME=function_name,
+ HANDLE=handle)
return name
def parameter_type(self):
« no previous file with comments | « no previous file | lib/dom/templates/dom/native/cpp_implementation.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698