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

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: Addressed review comments 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 eb03c9f02459e6392e8d86b56782968827cd6900..c9a2e978758cb7a5be3515f04b93a3f5d5e8d0d1 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -7300,8 +7300,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);
@@ -7563,8 +7568,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);
@@ -7933,8 +7943,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);
@@ -8188,9 +8203,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);
@@ -8409,8 +8428,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);
@@ -10986,8 +11009,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);
@@ -11554,8 +11582,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);
@@ -11781,8 +11814,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);
@@ -12428,8 +12466,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);
@@ -12644,8 +12687,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);
@@ -14643,8 +14691,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);
@@ -14870,8 +14923,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);
@@ -15097,8 +15155,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);
@@ -17586,8 +17649,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.
@@ -18069,8 +18137,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);
@@ -20469,8 +20542,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);
@@ -20758,8 +20836,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);
@@ -22169,8 +22252,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);
@@ -22383,8 +22471,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);
@@ -22823,8 +22916,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);
@@ -23300,8 +23398,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);
@@ -23527,8 +23630,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);
@@ -23754,8 +23862,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);
@@ -23978,8 +24091,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);
@@ -27894,8 +28012,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);
@@ -28100,8 +28223,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);
@@ -28306,8 +28434,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);
@@ -28512,8 +28645,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);
@@ -28718,8 +28856,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);
@@ -28924,8 +29067,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);
@@ -29193,8 +29341,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);
@@ -29423,8 +29576,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);
@@ -29629,8 +29787,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);
@@ -29835,8 +29998,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);
@@ -32693,7 +32861,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