Chromium Code Reviews| Index: sdk/lib/html/dartium/html_dartium.dart |
| diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart |
| index e2aff07cf3b8380f17f4db566a4f0ec50eda51ce..4a91c619ac249432eca5656fc71cf6926aae4f6a 100644 |
| --- a/sdk/lib/html/dartium/html_dartium.dart |
| +++ b/sdk/lib/html/dartium/html_dartium.dart |
| @@ -7246,7 +7246,11 @@ class DomStringList extends NativeFieldWrapperClass1 with ListMixin<String>, Imm |
| @DocsEditable |
| int get length native "DOMStringList_length_Getter"; |
| - String operator[](int index) native "DOMStringList_item_Callback"; |
| + String operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
|
sra1
2013/05/09 19:55:50
Do you know if the native indexer does a bounds ch
blois
2013/05/09 20:00:25
It does not throw an exception for out of bounds (
|
| + return _nativeIndexedGetter(index); |
| + } |
| + String _nativeIndexedGetter(int index) native "DOMStringList_item_Callback"; |
| void operator[]=(int index, String value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -7259,6 +7263,34 @@ class DomStringList extends NativeFieldWrapperClass1 with ListMixin<String>, Imm |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + String get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + String get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + String get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + String elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<String> mixins. |
| @DomName('DOMStringList.contains') |
| @@ -9533,7 +9565,11 @@ class FileList extends NativeFieldWrapperClass1 with ListMixin<File>, ImmutableL |
| @DocsEditable |
| int get length native "FileList_length_Getter"; |
| - File operator[](int index) native "FileList_item_Callback"; |
| + File operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + File _nativeIndexedGetter(int index) native "FileList_item_Callback"; |
| void operator[]=(int index, File value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -9546,6 +9582,34 @@ class FileList extends NativeFieldWrapperClass1 with ListMixin<File>, ImmutableL |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + File get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + File get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + File get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + File elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<File> mixins. |
| @DomName('FileList.item') |
| @@ -10379,7 +10443,11 @@ class HtmlAllCollection extends NativeFieldWrapperClass1 with ListMixin<Node>, I |
| @DocsEditable |
| int get length native "HTMLAllCollection_length_Getter"; |
| - Node operator[](int index) native "HTMLAllCollection_item_Callback"; |
| + Node operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + Node _nativeIndexedGetter(int index) native "HTMLAllCollection_item_Callback"; |
| void operator[]=(int index, Node value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -10392,6 +10460,34 @@ class HtmlAllCollection extends NativeFieldWrapperClass1 with ListMixin<Node>, I |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + Node get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Node get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Node get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + Node elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<Node> mixins. |
| @DomName('HTMLAllCollection.item') |
| @@ -10423,7 +10519,11 @@ class HtmlCollection extends NativeFieldWrapperClass1 with ListMixin<Node>, Immu |
| @DocsEditable |
| int get length native "HTMLCollection_length_Getter"; |
| - Node operator[](int index) native "HTMLCollection_item_Callback"; |
| + Node operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + Node _nativeIndexedGetter(int index) native "HTMLCollection_item_Callback"; |
| void operator[]=(int index, Node value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -10436,6 +10536,34 @@ class HtmlCollection extends NativeFieldWrapperClass1 with ListMixin<Node>, Immu |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + Node get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Node get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Node get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + Node elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<Node> mixins. |
| @DomName('HTMLCollection.item') |
| @@ -14500,7 +14628,11 @@ class MimeTypeArray extends NativeFieldWrapperClass1 with ListMixin<MimeType>, I |
| @DocsEditable |
| int get length native "DOMMimeTypeArray_length_Getter"; |
| - MimeType operator[](int index) native "DOMMimeTypeArray_item_Callback"; |
| + MimeType operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + MimeType _nativeIndexedGetter(int index) native "DOMMimeTypeArray_item_Callback"; |
| void operator[]=(int index, MimeType value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -14513,6 +14645,34 @@ class MimeTypeArray extends NativeFieldWrapperClass1 with ListMixin<MimeType>, I |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + MimeType get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + MimeType get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + MimeType get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + MimeType elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<MimeType> mixins. |
| @DomName('DOMMimeTypeArray.item') |
| @@ -15717,7 +15877,11 @@ class NodeList extends NativeFieldWrapperClass1 with ListMixin<Node>, ImmutableL |
| @DocsEditable |
| int get length native "NodeList_length_Getter"; |
| - Node operator[](int index) native "NodeList_item_Callback"; |
| + Node operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + Node _nativeIndexedGetter(int index) native "NodeList_item_Callback"; |
| void operator[]=(int index, Node value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -15730,6 +15894,34 @@ class NodeList extends NativeFieldWrapperClass1 with ListMixin<Node>, ImmutableL |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + Node get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Node get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Node get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + Node elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<Node> mixins. |
| @DomName('NodeList.item') |
| @@ -16854,7 +17046,11 @@ class PluginArray extends NativeFieldWrapperClass1 with ListMixin<Plugin>, Immut |
| @DocsEditable |
| int get length native "DOMPluginArray_length_Getter"; |
| - Plugin operator[](int index) native "DOMPluginArray_item_Callback"; |
| + Plugin operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + Plugin _nativeIndexedGetter(int index) native "DOMPluginArray_item_Callback"; |
| void operator[]=(int index, Plugin value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -16867,6 +17063,34 @@ class PluginArray extends NativeFieldWrapperClass1 with ListMixin<Plugin>, Immut |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + Plugin get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Plugin get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Plugin get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + Plugin elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<Plugin> mixins. |
| @DomName('DOMPluginArray.item') |
| @@ -18644,7 +18868,11 @@ class SourceBufferList extends EventTarget with ListMixin<SourceBuffer>, Immutab |
| @DocsEditable |
| int get length native "SourceBufferList_length_Getter"; |
| - SourceBuffer operator[](int index) native "SourceBufferList_item_Callback"; |
| + SourceBuffer operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + SourceBuffer _nativeIndexedGetter(int index) native "SourceBufferList_item_Callback"; |
| void operator[]=(int index, SourceBuffer value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -18657,6 +18885,34 @@ class SourceBufferList extends EventTarget with ListMixin<SourceBuffer>, Immutab |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + SourceBuffer get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + SourceBuffer get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + SourceBuffer get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + SourceBuffer elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<SourceBuffer> mixins. |
| @DomName('SourceBufferList.addEventListener') |
| @@ -18797,7 +19053,11 @@ class SpeechGrammarList extends NativeFieldWrapperClass1 with ListMixin<SpeechGr |
| @DocsEditable |
| int get length native "SpeechGrammarList_length_Getter"; |
| - SpeechGrammar operator[](int index) native "SpeechGrammarList_item_Callback"; |
| + SpeechGrammar operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + SpeechGrammar _nativeIndexedGetter(int index) native "SpeechGrammarList_item_Callback"; |
| void operator[]=(int index, SpeechGrammar value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -18810,6 +19070,34 @@ class SpeechGrammarList extends NativeFieldWrapperClass1 with ListMixin<SpeechGr |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + SpeechGrammar get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + SpeechGrammar get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + SpeechGrammar get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + SpeechGrammar elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<SpeechGrammar> mixins. |
| void addFromString(String string, [num weight]) { |
| @@ -20362,7 +20650,11 @@ class TextTrackCueList extends NativeFieldWrapperClass1 with ListMixin<TextTrack |
| @DocsEditable |
| int get length native "TextTrackCueList_length_Getter"; |
| - TextTrackCue operator[](int index) native "TextTrackCueList_item_Callback"; |
| + TextTrackCue operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + TextTrackCue _nativeIndexedGetter(int index) native "TextTrackCueList_item_Callback"; |
| void operator[]=(int index, TextTrackCue value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -20375,6 +20667,34 @@ class TextTrackCueList extends NativeFieldWrapperClass1 with ListMixin<TextTrack |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + TextTrackCue get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + TextTrackCue get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + TextTrackCue get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + TextTrackCue elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<TextTrackCue> mixins. |
| @DomName('TextTrackCueList.getCueById') |
| @@ -20406,7 +20726,11 @@ class TextTrackList extends EventTarget with ListMixin<TextTrack>, ImmutableList |
| @DocsEditable |
| int get length native "TextTrackList_length_Getter"; |
| - TextTrack operator[](int index) native "TextTrackList_item_Callback"; |
| + TextTrack operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + TextTrack _nativeIndexedGetter(int index) native "TextTrackList_item_Callback"; |
| void operator[]=(int index, TextTrack value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -20419,6 +20743,34 @@ class TextTrackList extends EventTarget with ListMixin<TextTrack>, ImmutableList |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + TextTrack get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + TextTrack get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + TextTrack get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + TextTrack elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<TextTrack> mixins. |
| @DomName('TextTrackList.addEventListener') |
| @@ -20667,7 +21019,11 @@ class TouchList extends NativeFieldWrapperClass1 with ListMixin<Touch>, Immutabl |
| @DocsEditable |
| int get length native "TouchList_length_Getter"; |
| - Touch operator[](int index) native "TouchList_item_Callback"; |
| + Touch operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + Touch _nativeIndexedGetter(int index) native "TouchList_item_Callback"; |
| void operator[]=(int index, Touch value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -20680,6 +21036,34 @@ class TouchList extends NativeFieldWrapperClass1 with ListMixin<Touch>, Immutabl |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + Touch get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Touch get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Touch get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + Touch elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<Touch> mixins. |
| @DomName('TouchList.item') |
| @@ -22796,7 +23180,11 @@ class _ClientRectList extends NativeFieldWrapperClass1 with ListMixin<Rect>, Imm |
| @DocsEditable |
| int get length native "ClientRectList_length_Getter"; |
| - Rect operator[](int index) native "ClientRectList_item_Callback"; |
| + Rect operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + Rect _nativeIndexedGetter(int index) native "ClientRectList_item_Callback"; |
| void operator[]=(int index, Rect value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -22809,6 +23197,34 @@ class _ClientRectList extends NativeFieldWrapperClass1 with ListMixin<Rect>, Imm |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + Rect get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Rect get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Rect get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + Rect elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<Rect> mixins. |
| @DomName('ClientRectList.item') |
| @@ -22845,7 +23261,11 @@ class _CssRuleList extends NativeFieldWrapperClass1 with ListMixin<CssRule>, Imm |
| @DocsEditable |
| int get length native "CSSRuleList_length_Getter"; |
| - CssRule operator[](int index) native "CSSRuleList_item_Callback"; |
| + CssRule operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + CssRule _nativeIndexedGetter(int index) native "CSSRuleList_item_Callback"; |
| void operator[]=(int index, CssRule value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -22858,6 +23278,34 @@ class _CssRuleList extends NativeFieldWrapperClass1 with ListMixin<CssRule>, Imm |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + CssRule get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + CssRule get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + CssRule get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + CssRule elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<CssRule> mixins. |
| @DomName('CSSRuleList.item') |
| @@ -22881,7 +23329,11 @@ class _CssValueList extends _CSSValue with ListMixin<_CSSValue>, ImmutableListMi |
| @DocsEditable |
| int get length native "CSSValueList_length_Getter"; |
| - _CSSValue operator[](int index) native "CSSValueList_item_Callback"; |
| + _CSSValue operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + _CSSValue _nativeIndexedGetter(int index) native "CSSValueList_item_Callback"; |
| void operator[]=(int index, _CSSValue value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -22894,6 +23346,34 @@ class _CssValueList extends _CSSValue with ListMixin<_CSSValue>, ImmutableListMi |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + _CSSValue get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + _CSSValue get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + _CSSValue get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + _CSSValue elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<_CSSValue> mixins. |
| @DomName('CSSValueList.item') |
| @@ -23185,7 +23665,11 @@ class _EntryArray extends NativeFieldWrapperClass1 with ListMixin<Entry>, Immuta |
| @DocsEditable |
| int get length native "EntryArray_length_Getter"; |
| - Entry operator[](int index) native "EntryArray_item_Callback"; |
| + Entry operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + Entry _nativeIndexedGetter(int index) native "EntryArray_item_Callback"; |
| void operator[]=(int index, Entry value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -23198,6 +23682,34 @@ class _EntryArray extends NativeFieldWrapperClass1 with ListMixin<Entry>, Immuta |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + Entry get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Entry get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Entry get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + Entry elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<Entry> mixins. |
| @DomName('EntryArray.item') |
| @@ -23221,7 +23733,11 @@ class _EntryArraySync extends NativeFieldWrapperClass1 with ListMixin<_EntrySync |
| @DocsEditable |
| int get length native "EntryArraySync_length_Getter"; |
| - _EntrySync operator[](int index) native "EntryArraySync_item_Callback"; |
| + _EntrySync operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + _EntrySync _nativeIndexedGetter(int index) native "EntryArraySync_item_Callback"; |
| void operator[]=(int index, _EntrySync value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -23234,6 +23750,34 @@ class _EntryArraySync extends NativeFieldWrapperClass1 with ListMixin<_EntrySync |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + _EntrySync get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + _EntrySync get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + _EntrySync get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + _EntrySync elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<_EntrySync> mixins. |
| @DomName('EntryArraySync.item') |
| @@ -23318,7 +23862,11 @@ class _GamepadList extends NativeFieldWrapperClass1 with ListMixin<Gamepad>, Imm |
| @DocsEditable |
| int get length native "GamepadList_length_Getter"; |
| - Gamepad operator[](int index) native "GamepadList_item_Callback"; |
| + Gamepad operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + Gamepad _nativeIndexedGetter(int index) native "GamepadList_item_Callback"; |
| void operator[]=(int index, Gamepad value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -23331,6 +23879,34 @@ class _GamepadList extends NativeFieldWrapperClass1 with ListMixin<Gamepad>, Imm |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + Gamepad get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Gamepad get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Gamepad get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + Gamepad elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<Gamepad> mixins. |
| @DomName('GamepadList.item') |
| @@ -23445,7 +24021,11 @@ class _NamedNodeMap extends NativeFieldWrapperClass1 with ListMixin<Node>, Immut |
| @DocsEditable |
| int get length native "NamedNodeMap_length_Getter"; |
| - Node operator[](int index) native "NamedNodeMap_item_Callback"; |
| + Node operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + Node _nativeIndexedGetter(int index) native "NamedNodeMap_item_Callback"; |
| void operator[]=(int index, Node value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -23458,6 +24038,34 @@ class _NamedNodeMap extends NativeFieldWrapperClass1 with ListMixin<Node>, Immut |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + Node get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Node get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + Node get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + Node elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<Node> mixins. |
| @DomName('NamedNodeMap.getNamedItem') |
| @@ -23589,7 +24197,11 @@ class _SpeechInputResultList extends NativeFieldWrapperClass1 with ListMixin<Spe |
| @DocsEditable |
| int get length native "SpeechInputResultList_length_Getter"; |
| - SpeechInputResult operator[](int index) native "SpeechInputResultList_item_Callback"; |
| + SpeechInputResult operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + SpeechInputResult _nativeIndexedGetter(int index) native "SpeechInputResultList_item_Callback"; |
| void operator[]=(int index, SpeechInputResult value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -23602,6 +24214,34 @@ class _SpeechInputResultList extends NativeFieldWrapperClass1 with ListMixin<Spe |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + SpeechInputResult get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + SpeechInputResult get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + SpeechInputResult get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + SpeechInputResult elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<SpeechInputResult> mixins. |
| @DomName('SpeechInputResultList.item') |
| @@ -23625,7 +24265,11 @@ class _SpeechRecognitionResultList extends NativeFieldWrapperClass1 with ListMix |
| @DocsEditable |
| int get length native "SpeechRecognitionResultList_length_Getter"; |
| - SpeechRecognitionResult operator[](int index) native "SpeechRecognitionResultList_item_Callback"; |
| + SpeechRecognitionResult operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + SpeechRecognitionResult _nativeIndexedGetter(int index) native "SpeechRecognitionResultList_item_Callback"; |
| void operator[]=(int index, SpeechRecognitionResult value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -23638,6 +24282,34 @@ class _SpeechRecognitionResultList extends NativeFieldWrapperClass1 with ListMix |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + SpeechRecognitionResult get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + SpeechRecognitionResult get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + SpeechRecognitionResult get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + SpeechRecognitionResult elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<SpeechRecognitionResult> mixins. |
| @DomName('SpeechRecognitionResultList.item') |
| @@ -23661,7 +24333,11 @@ class _StyleSheetList extends NativeFieldWrapperClass1 with ListMixin<StyleSheet |
| @DocsEditable |
| int get length native "StyleSheetList_length_Getter"; |
| - StyleSheet operator[](int index) native "StyleSheetList_item_Callback"; |
| + StyleSheet operator[](int index) { |
| + if (index < 0 || index >= length) throw new RangeError.range(index, 0, length); |
| + return _nativeIndexedGetter(index); |
| + } |
| + StyleSheet _nativeIndexedGetter(int index) native "StyleSheetList_item_Callback"; |
| void operator[]=(int index, StyleSheet value) { |
| throw new UnsupportedError("Cannot assign element of immutable List."); |
| @@ -23674,6 +24350,34 @@ class _StyleSheetList extends NativeFieldWrapperClass1 with ListMixin<StyleSheet |
| throw new UnsupportedError("Cannot resize immutable List."); |
| } |
| + StyleSheet get first { |
| + if (this.length > 0) { |
| + return this[0]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + StyleSheet get last { |
| + int len = this.length; |
| + if (len > 0) { |
| + return this[len - 1]; |
| + } |
| + throw new StateError("No elements"); |
| + } |
| + |
| + StyleSheet get single { |
| + int len = this.length; |
| + if (len == 1) { |
| + return this[0]; |
| + } |
| + if (len == 0) throw new StateError("No elements"); |
| + throw new StateError("More than one element"); |
| + } |
| + |
| + StyleSheet elementAt(int index) { |
| + return this[index]; |
| + } |
| + |
| // -- end List<StyleSheet> mixins. |
| @DomName('StyleSheetList.item') |