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

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

Issue 14036014: Updating DOM code to use list mixins (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
Index: tools/dom/scripts/htmldartgenerator.py
diff --git a/tools/dom/scripts/htmldartgenerator.py b/tools/dom/scripts/htmldartgenerator.py
index 0c351873f3cdd59e14c57d85020532583974979f..83be7d2fd15c8a424286df3e6754e44778405d97 100644
--- a/tools/dom/scripts/htmldartgenerator.py
+++ b/tools/dom/scripts/htmldartgenerator.py
@@ -329,6 +329,21 @@ class HtmlDartGenerator(object):
implements.append('List<%s>' % item_type_info.dart_type())
return implements
+ def Mixins(self):
+ mixins = []
+ item_type = None
+ if self._interface_type_info.is_typed_array():
+ item_type = self._interface_type_info.list_item_type()
+ elif self._interface_type_info.list_item_type():
+ item_type = self._type_registry.TypeInfo(
+ self._interface_type_info.list_item_type()).dart_type()
+ if item_type:
+ mixins.append('ListMixin<%s>' % item_type)
+ mixins.append('ImmutableListMixin<%s>' % item_type)
+
+ return mixins
+
+
def AddConstructors(self,
constructors, factory_name, factory_constructor_name):
""" Adds all of the constructors.
@@ -563,8 +578,6 @@ class HtmlDartGenerator(object):
# TODO(sra): Use separate mixins for mutable implementations of List<T>.
# TODO(sra): Use separate mixins for typed array implementations of List<T>.
template_file = 'immutable_list_mixin.darttemplate'
- has_contains = any(op.id == 'contains' for op in self._interface.operations)
- has_clear = any(op.id == 'clear' for op in self._interface.operations)
has_length = False
has_length_setter = False
typed_array = self._interface_type_info.is_typed_array()
@@ -580,8 +593,6 @@ class HtmlDartGenerator(object):
template = self._template_loader.Load(
template_file,
{
- 'DEFINE_CONTAINS': not has_contains,
- 'DEFINE_CLEAR': not has_clear,
'DEFINE_IMMUTABLE': not typed_array,
'DEFINE_LENGTH_AS_NUM_ITEMS': not has_length and has_num_items,
'DEFINE_LENGTH_SETTER': not has_length_setter,

Powered by Google App Engine
This is Rietveld 408576698