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

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 12817003: Change getRange to sublist. Make getRange deprecated. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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:
Download patch
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 87c5c463e50e3767e6881444aaa0a1bb9f47454e..fabde8bfff7e71c1373319e6033647ed02ab1aad 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -7296,8 +7296,13 @@ class DomMimeTypeArray implements JavaScriptIndexingBehavior, List<DomMimeType>
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<DomMimeType> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <DomMimeType>[]);
+ }
+
List<DomMimeType> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <DomMimeType>[]);
+ sublist(start, start + rangeLength);
Map<int, DomMimeType> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -7555,8 +7560,13 @@ class DomPluginArray implements JavaScriptIndexingBehavior, List<DomPlugin> nati
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<DomPlugin> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <DomPlugin>[]);
+ }
+
List<DomPlugin> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <DomPlugin>[]);
+ sublist(start, start + rangeLength);
Map<int, DomPlugin> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -7921,8 +7931,13 @@ class DomStringList implements JavaScriptIndexingBehavior, List<String> native "
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<String> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <String>[]);
+ }
+
List<String> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <String>[]);
+ sublist(start, start + rangeLength);
Map<int, String> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -8176,9 +8191,13 @@ class _ChildrenElementList implements List {
throw new UnimplementedError();
}
+ List sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return new _FrozenElementList._wrap(Lists.getRange(this, start, end, []));
+ }
+
List getRange(int start, int rangeLength) =>
- new _FrozenElementList._wrap(Lists.getRange(this, start, rangeLength,
- []));
+ sublist(start, start + rangeLength);
int indexOf(Element element, [int start = 0]) {
return Lists.indexOf(this, element, start, this.length);
@@ -8386,8 +8405,12 @@ class _FrozenElementList implements List {
throw new UnsupportedError('');
}
+ List<Element> sublist(int start, [int end]) {
+ return new _FrozenElementList._wrap(_nodeList.sublist(start, end));
+ }
+
List<Element> getRange(int start, int rangeLength) =>
- new _FrozenElementList._wrap(_nodeList.getRange(start, rangeLength));
+ sublist(start, start + rangeLength);
int indexOf(Element element, [int start = 0]) =>
_nodeList.indexOf(element, start);
@@ -10959,8 +10982,13 @@ class FileList implements JavaScriptIndexingBehavior, List<File> native "*FileLi
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<File> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <File>[]);
+ }
+
List<File> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <File>[]);
+ sublist(start, start + rangeLength);
Map<int, File> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -11523,8 +11551,13 @@ class Float32Array extends ArrayBufferView implements JavaScriptIndexingBehavior
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<num> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <num>[]);
+ }
+
List<num> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <num>[]);
+ sublist(start, start + rangeLength);
Map<int, num> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -11746,8 +11779,13 @@ class Float64Array extends ArrayBufferView implements JavaScriptIndexingBehavior
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<num> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <num>[]);
+ }
+
List<num> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <num>[]);
+ sublist(start, start + rangeLength);
Map<int, num> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -12389,8 +12427,13 @@ class HtmlAllCollection implements JavaScriptIndexingBehavior, List<Node> native
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<Node> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <Node>[]);
+ }
+
List<Node> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <Node>[]);
+ sublist(start, start + rangeLength);
Map<int, Node> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -12601,8 +12644,13 @@ class HtmlCollection implements JavaScriptIndexingBehavior, List<Node> native "*
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<Node> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <Node>[]);
+ }
+
List<Node> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <Node>[]);
+ sublist(start, start + rangeLength);
Map<int, Node> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -14596,8 +14644,13 @@ class Int16Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<int> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <int>[]);
+ }
+
List<int> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <int>[]);
+ sublist(start, start + rangeLength);
Map<int, int> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -14819,8 +14872,13 @@ class Int32Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<int> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <int>[]);
+ }
+
List<int> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <int>[]);
+ sublist(start, start + rangeLength);
Map<int, int> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -15042,8 +15100,13 @@ class Int8Array extends ArrayBufferView implements JavaScriptIndexingBehavior, L
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<int> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <int>[]);
+ }
+
List<int> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <int>[]);
+ sublist(start, start + rangeLength);
Map<int, int> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -17520,8 +17583,13 @@ class _ChildNodeListLazy implements List {
throw new UnsupportedError(
"Cannot insertRange on immutable List.");
}
+ List<Node> sublist(int start, [int end]) {
+ if (end == null) end == length;
+ return Lists.getRange(this, start, end, <Node>[]);
+ }
+
List<Node> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <Node>[]);
+ sublist(start, start + rangeLength);
// -- end List<Node> mixins.
@@ -17999,8 +18067,13 @@ class NodeList implements JavaScriptIndexingBehavior, List<Node> native "*NodeLi
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<Node> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <Node>[]);
+ }
+
List<Node> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <Node>[]);
+ sublist(start, start + rangeLength);
Map<int, Node> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -20395,8 +20468,13 @@ class SourceBufferList extends EventTarget implements JavaScriptIndexingBehavior
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<SourceBuffer> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <SourceBuffer>[]);
+ }
+
List<SourceBuffer> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <SourceBuffer>[]);
+ sublist(start, start + rangeLength);
Map<int, SourceBuffer> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -20680,8 +20758,13 @@ class SpeechGrammarList implements JavaScriptIndexingBehavior, List<SpeechGramma
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<SpeechGrammar> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <SpeechGrammar>[]);
+ }
+
List<SpeechGrammar> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <SpeechGrammar>[]);
+ sublist(start, start + rangeLength);
Map<int, SpeechGrammar> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -22087,8 +22170,13 @@ class TextTrackCueList implements List<TextTrackCue>, JavaScriptIndexingBehavior
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<TextTrackCue> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <TextTrackCue>[]);
+ }
+
List<TextTrackCue> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <TextTrackCue>[]);
+ sublist(start, start + rangeLength);
Map<int, TextTrackCue> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -22297,8 +22385,13 @@ class TextTrackList extends EventTarget implements JavaScriptIndexingBehavior, L
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<TextTrack> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <TextTrack>[]);
+ }
+
List<TextTrack> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <TextTrack>[]);
+ sublist(start, start + rangeLength);
Map<int, TextTrack> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -22733,8 +22826,13 @@ class TouchList implements JavaScriptIndexingBehavior, List<Touch> native "*Touc
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<Touch> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <Touch>[]);
+ }
+
List<Touch> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <Touch>[]);
+ sublist(start, start + rangeLength);
Map<int, Touch> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -23206,8 +23304,13 @@ class Uint16Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<int> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <int>[]);
+ }
+
List<int> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <int>[]);
+ sublist(start, start + rangeLength);
Map<int, int> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -23429,8 +23532,13 @@ class Uint32Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<int> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <int>[]);
+ }
+
List<int> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <int>[]);
+ sublist(start, start + rangeLength);
Map<int, int> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -23652,8 +23760,13 @@ class Uint8Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<int> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <int>[]);
+ }
+
List<int> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <int>[]);
+ sublist(start, start + rangeLength);
Map<int, int> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -23872,8 +23985,13 @@ class Uint8ClampedArray extends Uint8Array implements JavaScriptIndexingBehavior
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<int> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <int>[]);
+ }
+
List<int> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <int>[]);
+ sublist(start, start + rangeLength);
Map<int, int> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -27784,8 +27902,13 @@ class _ClientRectList implements JavaScriptIndexingBehavior, List<Rect> native "
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<Rect> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <Rect>[]);
+ }
+
List<Rect> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <Rect>[]);
+ sublist(start, start + rangeLength);
Map<int, Rect> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -27986,8 +28109,13 @@ class _CssRuleList implements JavaScriptIndexingBehavior, List<CssRule> native "
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<CssRule> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <CssRule>[]);
+ }
+
List<CssRule> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <CssRule>[]);
+ sublist(start, start + rangeLength);
Map<int, CssRule> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -28188,8 +28316,13 @@ class _CssValueList extends CssValue implements List<CssValue>, JavaScriptIndexi
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<CssValue> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <CssValue>[]);
+ }
+
List<CssValue> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <CssValue>[]);
+ sublist(start, start + rangeLength);
Map<int, CssValue> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -28390,8 +28523,13 @@ class _EntryArray implements JavaScriptIndexingBehavior, List<Entry> native "*En
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<Entry> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <Entry>[]);
+ }
+
List<Entry> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <Entry>[]);
+ sublist(start, start + rangeLength);
Map<int, Entry> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -28592,8 +28730,13 @@ class _EntryArraySync implements JavaScriptIndexingBehavior, List<EntrySync> nat
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<EntrySync> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <EntrySync>[]);
+ }
+
List<EntrySync> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <EntrySync>[]);
+ sublist(start, start + rangeLength);
Map<int, EntrySync> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -28794,8 +28937,13 @@ class _GamepadList implements JavaScriptIndexingBehavior, List<Gamepad> native "
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<Gamepad> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <Gamepad>[]);
+ }
+
List<Gamepad> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <Gamepad>[]);
+ sublist(start, start + rangeLength);
Map<int, Gamepad> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -29059,8 +29207,13 @@ class _NamedNodeMap implements JavaScriptIndexingBehavior, List<Node> native "*N
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<Node> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <Node>[]);
+ }
+
List<Node> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <Node>[]);
+ sublist(start, start + rangeLength);
Map<int, Node> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -29285,8 +29438,13 @@ class _SpeechInputResultList implements JavaScriptIndexingBehavior, List<SpeechI
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<SpeechInputResult> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <SpeechInputResult>[]);
+ }
+
List<SpeechInputResult> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <SpeechInputResult>[]);
+ sublist(start, start + rangeLength);
Map<int, SpeechInputResult> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -29487,8 +29645,13 @@ class _SpeechRecognitionResultList implements JavaScriptIndexingBehavior, List<S
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<SpeechRecognitionResult> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <SpeechRecognitionResult>[]);
+ }
+
List<SpeechRecognitionResult> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <SpeechRecognitionResult>[]);
+ sublist(start, start + rangeLength);
Map<int, SpeechRecognitionResult> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -29689,8 +29852,13 @@ class _StyleSheetList implements JavaScriptIndexingBehavior, List<StyleSheet> na
throw new UnsupportedError("Cannot insertRange on immutable List.");
}
+ List<StyleSheet> sublist(int start, [int end]) {
+ if (end == null) end = length;
+ return Lists.getRange(this, start, end, <StyleSheet>[]);
+ }
+
List<StyleSheet> getRange(int start, int rangeLength) =>
- Lists.getRange(this, start, rangeLength, <StyleSheet>[]);
+ sublist(start, start + rangeLength);
Map<int, StyleSheet> asMap() =>
IterableMixinWorkaround.asMapList(this);
@@ -32545,7 +32713,9 @@ class _WrappedList<E> implements List<E> {
E removeLast() => _list.removeLast();
- List<E> getRange(int start, int length) => _list.getRange(start, length);
+ List<E> sublist(int start, [int end]) => _list.sublist(start, end);
+
+ List<E> getRange(int start, int length) => sublist(start, start + length);
void setRange(int start, int length, List<E> from, [int startFrom]) {
_list.setRange(start, length, from, startFrom);

Powered by Google App Engine
This is Rietveld 408576698