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

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

Issue 23534050: Make direct calls to _nativeIndexedGetter in "get last" "get first" "get single" instead of calling… (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 | « sdk/lib/web_sql/dartium/web_sql_dartium.dart ('k') | tools/dom/scripts/templateloader.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/htmldartgenerator.py
===================================================================
--- tools/dom/scripts/htmldartgenerator.py (revision 27268)
+++ tools/dom/scripts/htmldartgenerator.py (working copy)
@@ -635,6 +635,20 @@
has_length = False
has_length_setter = False
+ def _HasExplicitIndexedGetter(self):
+ return any(op.id == 'getItem' for op in self._interface.operations)
+
+ def _HasCustomIndexedGetter(self):
+ return 'CustomIndexedGetter' in self._interface.ext_attrs
+
+ def _HasNativeIndexedGetter(self):
+ return not (_HasCustomIndexedGetter(self) or _HasExplicitIndexedGetter(self))
+
+ if _HasExplicitIndexedGetter(self):
+ getter_name = 'getItem'
+ else:
+ getter_name = '_nativeIndexedGetter'
+
for attr in self._interface.attributes:
if attr.id == 'length':
has_length = True
@@ -648,8 +662,9 @@
{
'DEFINE_LENGTH_AS_NUM_ITEMS': not has_length and has_num_items,
'DEFINE_LENGTH_SETTER': not has_length_setter,
+ 'USE_NATIVE_INDEXED_GETTER': _HasNativeIndexedGetter(self) or _HasExplicitIndexedGetter(self),
})
- self._members_emitter.Emit(template, E=element_name)
+ self._members_emitter.Emit(template, E=element_name, GETTER=getter_name)
def SecureOutputType(self, type_name, is_dart_type=False,
can_narrow_type=False):
« no previous file with comments | « sdk/lib/web_sql/dartium/web_sql_dartium.dart ('k') | tools/dom/scripts/templateloader.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698