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

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

Issue 10828031: Unify processing of the cases when argument is declared optional in IDLs and is not optional in Web… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Next iteration 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 074abb64d17a69343e197c3b9eccaf895027cef4..73a283e630c1c956317d1c97fa5911962473431d 100644
--- a/lib/dom/scripts/generator.py
+++ b/lib/dom/scripts/generator.py
@@ -483,9 +483,9 @@ class IDLTypeInfo(object):
def requires_v8_scope(self):
return self._data.requires_v8_scope
- def emit_to_native(self, emitter, idl_node, name, handle, interface_name):
+ def emit_to_native(self, emitter, idl_node, accept_null, name, handle, interface_name):
if 'Callback' in idl_node.ext_attrs:
- if set(['Optional', 'Callback']).issubset(idl_node.ext_attrs.keys()):
+ if accept_null:
flag = 'DartUtilities::ConvertNullToDefaultValue'
else:
flag = 'DartUtilities::ConvertNone'
@@ -596,7 +596,8 @@ class DOMStringArrayTypeInfo(SequenceIDLTypeInfo):
def __init__(self, data, item_info):
super(DOMStringArrayTypeInfo, self).__init__('DOMString[]', data, item_info)
- def emit_to_native(self, emitter, idl_node, name, handle, interface_name):
+ def emit_to_native(self, emitter, idl_node, accept_null, name, handle, interface_name):
+ assert not accept_null
emitter.Emit(
'\n'
' RefPtr<DOMStringList> $NAME = DartDOMStringList::toNative($HANDLE, exception);\n'
@@ -614,9 +615,9 @@ class PrimitiveIDLTypeInfo(IDLTypeInfo):
def __init__(self, idl_type, data):
super(PrimitiveIDLTypeInfo, self).__init__(idl_type, data)
- def emit_to_native(self, emitter, idl_node, name, handle, interface_name):
+ def emit_to_native(self, emitter, idl_node, accept_null, name, handle, interface_name):
function_name = 'dartTo%s' % self._capitalized_native_type()
- if idl_node.ext_attrs.get('Optional') == 'DefaultIsNullString':
+ if accept_null:
function_name += 'WithNullCheck'
type = self.native_type()
if type == 'SerializedScriptValue':
« 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