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

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

Issue 10831036: More radical variant of 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 | « 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 522c54080ec64953c0da460eb1f2aadbc8e255ca..7518b0134321f5beb8b17fa290bfce0199a70585 100644
--- a/lib/dom/scripts/generator.py
+++ b/lib/dom/scripts/generator.py
@@ -533,25 +533,22 @@ class IDLTypeInfo(object):
def requires_v8_scope(self):
return self._data.requires_v8_scope
- def to_native_info(self, idl_node, accept_null, name, interface_name):
+ def to_native_info(self, idl_node, interface_name):
cls = 'Dart%s' % self.idl_type()
if 'Callback' in idl_node.ext_attrs:
- function_name = 'create'
- if accept_null:
- function_name += 'WithNullCheck'
- return name, 'RefPtr<%s>' % self.native_type(), cls, function_name
+ return '%s', 'RefPtr<%s>' % self.native_type(), cls, 'create'
if self.custom_to_native():
type = 'RefPtr<%s>' % self.native_type()
- argument = '%s.get()' % name
+ argument_expression_template = '%s.get()'
else:
type = '%s*' % self.native_type()
if isinstance(self, SVGTearOffIDLTypeInfo) and not interface_name.endswith('List'):
- argument = '%s->propertyReference()' % name
+ argument_expression_template = '%s->propertyReference()'
else:
- argument = name
- return argument, type, cls, 'toNative'
+ argument_expression_template = '%s'
+ return argument_expression_template, type, cls, 'toNative'
def custom_to_native(self):
return self._data.custom_to_native
@@ -626,25 +623,21 @@ class DOMStringArrayTypeInfo(SequenceIDLTypeInfo):
def __init__(self, data, item_info):
super(DOMStringArrayTypeInfo, self).__init__('DOMString[]', data, item_info)
- def to_native_info(self, idl_node, accept_null, name, interface_name):
- assert not accept_null
- return name, 'RefPtr<DOMStringList>', 'DartDOMStringList', 'toNative'
+ def to_native_info(self, idl_node, interface_name):
+ return '%s', 'RefPtr<DOMStringList>', 'DartDOMStringList', 'toNative'
class PrimitiveIDLTypeInfo(IDLTypeInfo):
def __init__(self, idl_type, data):
super(PrimitiveIDLTypeInfo, self).__init__(idl_type, data)
- def to_native_info(self, idl_node, accept_null, name, interface_name):
- function_name = 'dartTo%s' % self._capitalized_native_type()
- if accept_null:
- function_name += 'WithNullCheck'
+ def to_native_info(self, idl_node, interface_name):
type = self.native_type()
if type == 'SerializedScriptValue':
type = 'RefPtr<%s>' % type
if type == 'String':
type = 'DartStringAdapter'
- return name, type, 'DartUtilities', function_name
+ return '%s', type, 'DartUtilities', 'dartTo%s' % self._capitalized_native_type()
def parameter_type(self):
if self.native_type() == 'String':
« 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