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

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

Issue 12094060: Better support for vector conversions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « tools/dom/idl/dart/dart.idl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/generator.py
diff --git a/tools/dom/scripts/generator.py b/tools/dom/scripts/generator.py
index 2e50632781552a463dd25ecef24913e46e1dac61..afe282986b050d357abf236f1e0a58152c92b3ee 100644
--- a/tools/dom/scripts/generator.py
+++ b/tools/dom/scripts/generator.py
@@ -961,7 +961,7 @@ class IDLTypeInfo(object):
return 'Dart%s' % self.idl_type()
def vector_to_dart_template_parameter(self):
- return self.bindings_class()
+ return self.native_type()
def to_native_info(self, idl_node, interface_name):
cls = self.bindings_class()
@@ -1120,12 +1120,16 @@ class SequenceIDLTypeInfo(IDLTypeInfo):
def to_native_info(self, idl_node, interface_name):
item_native_type = self._item_info.vector_to_dart_template_parameter()
- return '%s', 'Vector<%s>' % item_native_type, 'DartUtilities', 'toNativeVector<%s>' % item_native_type
+ if isinstance(self._item_info, PrimitiveIDLTypeInfo):
+ return '%s', 'Vector<%s>' % item_native_type, 'DartUtilities', 'toNativeVector<%s>' % item_native_type
+ return '%s', 'Vector< RefPtr<%s> >' % item_native_type, 'DartUtilities', 'toNativeVector< RefPtr<%s> >' % item_native_type
def pass_native_by_ref(self): return True
def to_dart_conversion(self, value, interface_name=None, attributes=None):
- return 'DartDOMWrapper::vectorToDart<%s>(%s)' % (self._item_info.vector_to_dart_template_parameter(), value)
+ if isinstance(self._item_info, PrimitiveIDLTypeInfo):
+ return 'DartDOMWrapper::vectorToDart(%s)' % value
+ return 'DartDOMWrapper::vectorToDart<%s>(%s)' % (self._item_info.bindings_class(), value)
def conversion_includes(self):
return self._item_info.conversion_includes()
« no previous file with comments | « tools/dom/idl/dart/dart.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698