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

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

Issue 23681014: - Modify toDart to first do a simple lookup in the appropriate table before going down the templati… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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 | « runtime/vm/dart_api_impl.cc ('k') | tools/dom/scripts/systemnative.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/generator.py
===================================================================
--- tools/dom/scripts/generator.py (revision 27632)
+++ tools/dom/scripts/generator.py (working copy)
@@ -709,6 +709,9 @@
def to_dart_conversion(self, value, interface_name=None, attributes=None):
return 'Dart%s::toDart(%s)' % (self._idl_type, value)
+ def return_to_dart_conversion(self, value, interface_name=None, attributes=None):
vsm 2013/09/19 21:05:57 nit: line len
siva 2013/09/19 23:50:34 Done.
+ return 'Dart%s::returnToDart(args, %s)' % (self._idl_type, value)
+
def custom_to_dart(self):
return self._data.custom_to_dart
@@ -832,6 +835,9 @@
return 'DartDOMWrapper::vectorToDart(%s)' % value
return 'DartDOMWrapper::vectorToDart<%s>(%s)' % (self._item_info.bindings_class(), value)
+ def return_to_dart_conversion(self, value, interface_name=None, attributes=None):
+ return 'Dart_SetReturnValue(args, %s)' % self.to_dart_conversion(value, interface_name, attributes)
vsm 2013/09/19 21:05:57 line len
siva 2013/09/19 23:50:34 Done.
+
def conversion_includes(self):
return self._item_info.conversion_includes()
@@ -889,6 +895,9 @@
function_name += 'WithNullCheck'
return '%s(%s)' % (function_name, value)
+ def return_to_dart_conversion(self, value, interface_name=None, attributes=None):
+ return 'Dart_SetReturnValue(args, %s)' % self.to_dart_conversion(value, interface_name, attributes)
+
def webcore_getter_name(self):
return self._data.webcore_getter_name
@@ -917,7 +926,7 @@
return 'receiver->'
return 'receiver->propertyReference().'
- def to_dart_conversion(self, value, interface_name, attributes):
+ def to_conversion_cast(self, value, interface_name, attributes):
svg_primitive_types = ['SVGAngle', 'SVGLength', 'SVGMatrix',
'SVGNumber', 'SVGPoint', 'SVGRect', 'SVGTransform']
conversion_cast = '%s::create(%s)'
@@ -932,8 +941,14 @@
else:
conversion_cast = 'static_cast<%s*>(%s)'
conversion_cast = conversion_cast % (self.native_type(), value)
- return 'Dart%s::toDart(%s)' % (self._idl_type, conversion_cast)
+ return '%s' % (conversion_cast)
+ def to_dart_conversion(self, value, interface_name, attributes):
+ return 'Dart%s::toDart(%s)' % (self._idl_type, self.to_conversion_cast(value, interface_name, attributes))
+
+ def return_to_dart_conversion(self, value, interface_name, attr):
+ return 'Dart%s::returnToDart(args, %s)' % (self._idl_type, self.to_conversion_cast(value, interface_name, attr))
+
def argument_expression(self, name, interface_name):
return name if interface_name.endswith('List') else '%s->propertyReference()' % name
@@ -949,6 +964,9 @@
def to_dart_conversion(self, value, interface_name, attributes):
return 'DartUtilities::arrayBufferViewToDart(%s)' % value
+ def return_to_dart_conversion(self, value, interface_name, attributes):
+ return 'Dart_SetReturnValue(args, %s)' % self.to_dart_conversion(value, interface_name, attributes)
+
def to_native_info(self, idl_node, interface_name):
return '%s.get()', 'RefPtr<%s>' % self._idl_type, 'DartUtilities', 'dartTo%s' % self._idl_type
@@ -966,6 +984,9 @@
function_name = function_name[0].lower() + function_name[1:]
return '%s(%s)' % (function_name, value)
+ def return_to_dart_conversion(self, value, interface_name, attributes):
+ return 'Dart_SetReturnValue(args, %s)' % self.to_dart_conversion(value, interface_name, attributes)
+
def to_native_info(self, idl_node, interface_name):
return '%s.get()', 'RefPtr<%s>' % self._idl_type, 'DartUtilities', 'dartTo%s' % self._idl_type
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | tools/dom/scripts/systemnative.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698