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

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

Issue 12334081: Fixing web_sql SqlResultSetRowList row accessor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
« tests/html/websql_test.dart ('K') | « tests/html/websql_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/systemhtml.py
diff --git a/tools/dom/scripts/systemhtml.py b/tools/dom/scripts/systemhtml.py
index 6b8f673e4ac00634257470c5c3b3cb80603a68e5..dd9d1f5c936a7e2f5fffd2681e2096742b7e4ef2 100644
--- a/tools/dom/scripts/systemhtml.py
+++ b/tools/dom/scripts/systemhtml.py
@@ -671,10 +671,27 @@ class Dart2JSBackend(HtmlDartGenerator):
#
# class YImpl extends ListBase<T> { copies of transitive XImpl methods; }
#
- self._members_emitter.Emit(
- '\n'
- ' $TYPE operator[](int index) => JS("$TYPE", "#[#]", this, index);\n',
- TYPE=self.SecureOutputType(element_type))
+
+ ext_attrs = self._interface.ext_attrs
+ has_indexed_getter = ('IndexedGetter' in ext_attrs or
+ 'CustomIndexedSetter' in ext_attrs)
+
+ if has_indexed_getter:
+ self._members_emitter.Emit(
+ '\n'
+ ' $TYPE operator[](int index) => '
+ 'JS("$TYPE", "#[#]", this, index);\n',
+ TYPE=self.SecureOutputType(element_type))
+ else:
+ if any(op.id == 'getItem' for op in self._interface.operations):
+ indexed_getter = 'this.getItem(index)'
+ elif any(op.id == 'item' for op in self._interface.operations):
+ indexed_getter = 'this.item(index)'
+ self._members_emitter.Emit(
+ '\n'
+ ' $TYPE operator[](int index) => $INDEXED_GETTER;\n',
+ INDEXED_GETTER=indexed_getter,
+ TYPE=self.SecureOutputType(element_type))
if 'CustomIndexedSetter' in self._interface.ext_attrs:
self._members_emitter.Emit(
« tests/html/websql_test.dart ('K') | « tests/html/websql_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698