Trying to fix SQLResultSetRowList's subscript operator to do type conversion

BUG=

Review URL: https://codereview.chromium.org/1779023002 .
This commit is contained in:
Alan Knight 2016-03-09 14:02:30 -08:00
parent f56704cd41
commit 051451d7e6
5 changed files with 20 additions and 7 deletions

View file

@ -210,7 +210,7 @@ class SqlResultSet extends Interceptor {
// http://www.w3.org/TR/webdatabase/#sqlresultsetrowlist // http://www.w3.org/TR/webdatabase/#sqlresultsetrowlist
@Experimental() // deprecated @Experimental() // deprecated
@Native("SQLResultSetRowList") @Native("SQLResultSetRowList")
class SqlResultSetRowList extends Interceptor with ListMixin<Map>, ImmutableListMixin<Map> implements JavaScriptIndexingBehavior, List<Map> { class SqlResultSetRowList extends Interceptor with ListMixin<Map>, ImmutableListMixin<Map> implements List<Map> {
// To suppress missing implicit constructor warnings. // To suppress missing implicit constructor warnings.
factory SqlResultSetRowList._() { throw new UnsupportedError("Not supported"); } factory SqlResultSetRowList._() { throw new UnsupportedError("Not supported"); }
@ -222,7 +222,7 @@ class SqlResultSetRowList extends Interceptor with ListMixin<Map>, ImmutableList
if (JS("bool", "# >>> 0 !== # || # >= #", index, if (JS("bool", "# >>> 0 !== # || # >= #", index,
index, index, length)) index, index, length))
throw new RangeError.index(index, this); throw new RangeError.index(index, this);
return JS("Map", "#[#]", this, index); return this.item(index);
} }
void operator[]=(int index, Map value) { void operator[]=(int index, Map value) {
throw new UnsupportedError("Cannot assign element of immutable List."); throw new UnsupportedError("Cannot assign element of immutable List.");
@ -264,8 +264,13 @@ class SqlResultSetRowList extends Interceptor with ListMixin<Map>, ImmutableList
@DomName('SQLResultSetRowList.item') @DomName('SQLResultSetRowList.item')
@DocsEditable() @DocsEditable()
@Creates('=Object') Map item(int index) {
Object item(int index) native; return convertNativeToDart_Dictionary(_item_1(index));
}
@JSName('item')
@DomName('SQLResultSetRowList.item')
@DocsEditable()
_item_1(index) native;
} }
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a // for details. All rights reserved. Use of this source code is governed by a

View file

@ -15095,6 +15095,12 @@
}, },
"encoding": { "encoding": {
"support_level": "untriaged" "support_level": "untriaged"
},
"fatal": {
"support_level": "untriaged"
},
"ignoreBOM": {
"support_level": "untriaged"
} }
}, },
"support_level": "untriaged" "support_level": "untriaged"

View file

@ -329,8 +329,6 @@ _dart2js_annotations = monitored.Dict('dartmetadata._dart2js_annotations', {
"@Returns('NodeList|HtmlCollection')", "@Returns('NodeList|HtmlCollection')",
], ],
'SQLResultSetRowList.item': ["@Creates('=Object')"],
# Touch targets are Elements in a Document, or the Document. # Touch targets are Elements in a Document, or the Document.
'Touch.target': [ 'Touch.target': [
"@Creates('Element|Document')", "@Creates('Element|Document')",

View file

@ -721,6 +721,9 @@ dart2js_conversions = monitored.Dict('generator.dart2js_conversions', {
'any set IDBObjectStore.put': _serialize_SSV, 'any set IDBObjectStore.put': _serialize_SSV,
'any set IDBCursor.update': _serialize_SSV, 'any set IDBCursor.update': _serialize_SSV,
'any get SQLResultSetRowList.item' :
Conversion('convertNativeToDart_Dictionary', 'dynamic', 'Map'),
# postMessage # postMessage
'SerializedScriptValue set': _serialize_SSV, 'SerializedScriptValue set': _serialize_SSV,
'any set CompositorWorkerGlobalScope.postMessage': _serialize_SSV, 'any set CompositorWorkerGlobalScope.postMessage': _serialize_SSV,

View file

@ -828,7 +828,8 @@ class Dart2JSBackend(HtmlDartGenerator):
ext_attrs = self._interface.ext_attrs ext_attrs = self._interface.ext_attrs
has_indexed_getter = 'CustomIndexedGetter' in ext_attrs has_indexed_getter = 'CustomIndexedGetter' in ext_attrs
for operation in self._interface.operations: for operation in self._interface.operations:
if operation.id == 'item' and 'getter' in operation.specials: if operation.id == 'item' and 'getter' in operation.specials \
and not self._OperationRequiresConversions(operation):
has_indexed_getter = True has_indexed_getter = True
break break
return has_indexed_getter return has_indexed_getter