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

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

Issue 10829037: Unify null treatment. (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 | lib/dom/scripts/systemnative.py » ('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 73a283e630c1c956317d1c97fa5911962473431d..aadb69b6392a5277e1513abe27b29499bec5c2ba 100644
--- a/lib/dom/scripts/generator.py
+++ b/lib/dom/scripts/generator.py
@@ -485,20 +485,19 @@ class IDLTypeInfo(object):
def emit_to_native(self, emitter, idl_node, accept_null, name, handle, interface_name):
if 'Callback' in idl_node.ext_attrs:
+ function_name = 'create'
if accept_null:
- flag = 'DartUtilities::ConvertNullToDefaultValue'
- else:
- flag = 'DartUtilities::ConvertNone'
+ function_name += 'WithNullCheck'
emitter.Emit(
'\n'
- ' RefPtr<$TYPE> $NAME = Dart$IDL_TYPE::create($HANDLE, $FLAG, exception);\n'
+ ' RefPtr<$TYPE> $NAME = Dart$IDL_TYPE::$FUNCTION_NAME($HANDLE, exception);\n'
' if (exception)\n'
' goto fail;\n',
TYPE=self.native_type(),
NAME=name,
+ FUNCTION_NAME=function_name,
IDL_TYPE=self.idl_type(),
- HANDLE=handle,
- FLAG=flag)
+ HANDLE=handle)
return name
argument = name
@@ -647,13 +646,12 @@ class PrimitiveIDLTypeInfo(IDLTypeInfo):
return []
def to_dart_conversion(self, value, interface_name=None, attributes=None):
- conversion_arguments = [value]
- if attributes and 'TreatReturnedNullStringAs' in attributes:
- conversion_arguments.append('DartUtilities::ConvertNullToDefaultValue')
function_name = self._capitalized_native_type()
function_name = function_name[0].lower() + function_name[1:]
function_name = 'DartUtilities::%sToDart' % function_name
- return '%s(%s)' % (function_name, ', '.join(conversion_arguments))
+ if attributes and 'TreatReturnedNullStringAs' in attributes:
+ function_name += 'WithNullCheck'
+ return '%s(%s)' % (function_name, value)
def webcore_getter_name(self):
return self._data.webcore_getter_name
« no previous file with comments | « no previous file | lib/dom/scripts/systemnative.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698