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

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

Side-by-side diff isn't available for this file because of its large size.
Issue 12383073: Add List.insert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use insertBefore and add is-check. 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
« no previous file with comments | « sdk/lib/core/list.dart ('k') | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fdd1df8b008e77ef5a4ea6cd91f3eab296d4a3ff..e2c674ad0c73f0d10b268e5d48a8a2e862cc34a3 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -7321,6 +7321,10 @@ class DomMimeTypeArray implements JavaScriptIndexingBehavior, List<DomMimeType>
DomMimeType max([int compare(DomMimeType a, DomMimeType b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, DomMimeType element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
DomMimeType removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -7580,6 +7584,10 @@ class DomPluginArray implements JavaScriptIndexingBehavior, List<DomPlugin> nati
DomPlugin max([int compare(DomPlugin a, DomPlugin b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, DomPlugin element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
DomPlugin removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -7946,6 +7954,10 @@ class DomStringList implements JavaScriptIndexingBehavior, List<String> native "
String max([int compare(String a, String b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, String element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
String removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -8254,6 +8266,17 @@ class _ChildrenElementList implements List {
return Lists.lastIndexOf(this, element, start);
}
+ void insert(int index, Element element) {
+ if (index < 0 || index > length) {
+ throw new RangeError.range(index, 0, length);
+ }
+ if (index == length) {
+ _element.$dom_appendChild(element);
+ } else {
+ throw new UnimplementedError("insert on ElementLists");
+ }
+ }
+
void clear() {
// It is unclear if we want to keep non element nodes?
_element.text = '';
@@ -11006,6 +11029,10 @@ class FileList implements JavaScriptIndexingBehavior, List<File> native "*FileLi
File max([int compare(File a, File b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, File element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
File removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -11568,6 +11595,10 @@ class Float32Array extends ArrayBufferView implements JavaScriptIndexingBehavior
num max([int compare(num a, num b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, num element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
num removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -11789,6 +11820,10 @@ class Float64Array extends ArrayBufferView implements JavaScriptIndexingBehavior
num max([int compare(num a, num b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, num element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
num removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -12430,6 +12465,10 @@ class HtmlAllCollection implements JavaScriptIndexingBehavior, List<Node> native
Node max([int compare(Node a, Node b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, Node element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
Node removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -12642,6 +12681,10 @@ class HtmlCollection implements JavaScriptIndexingBehavior, List<Node> native "*
Node max([int compare(Node a, Node b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, Node element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
Node removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -14637,6 +14680,10 @@ class Int16Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
int max([int compare(int a, int b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, int element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
int removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -14858,6 +14905,10 @@ class Int32Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
int max([int compare(int a, int b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, int element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
int removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -15079,6 +15130,10 @@ class Int8Array extends ArrayBufferView implements JavaScriptIndexingBehavior, L
int max([int compare(int a, int b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, int element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
int removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -17442,6 +17497,17 @@ class _ChildNodeListLazy implements List {
}
}
+ void insert(int index, Node node) {
+ if (index < 0 || index > length) {
+ throw new RangeError.range(index, 0, length);
+ }
+ if (index == length) {
+ _this.$dom_appendChild(node);
+ } else {
+ this_.insertBefore(node, this[index]);
+ }
+ }
+
Node removeLast() {
final result = last;
if (result != null) {
@@ -18030,6 +18096,10 @@ class NodeList implements JavaScriptIndexingBehavior, List<Node> native "*NodeLi
Node max([int compare(Node a, Node b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, Node element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
Node removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -20429,6 +20499,10 @@ class SourceBufferList extends EventTarget implements JavaScriptIndexingBehavior
SourceBuffer max([int compare(SourceBuffer a, SourceBuffer b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, SourceBuffer element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
SourceBuffer removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -20714,6 +20788,10 @@ class SpeechGrammarList implements JavaScriptIndexingBehavior, List<SpeechGramma
SpeechGrammar max([int compare(SpeechGrammar a, SpeechGrammar b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, SpeechGrammar element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
SpeechGrammar removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -22121,6 +22199,10 @@ class TextTrackCueList implements List<TextTrackCue>, JavaScriptIndexingBehavior
TextTrackCue max([int compare(TextTrackCue a, TextTrackCue b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, TextTrackCue element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
TextTrackCue removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -22331,6 +22413,10 @@ class TextTrackList extends EventTarget implements JavaScriptIndexingBehavior, L
TextTrack max([int compare(TextTrack a, TextTrack b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, TextTrack element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
TextTrack removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -22767,6 +22853,10 @@ class TouchList implements JavaScriptIndexingBehavior, List<Touch> native "*Touc
Touch max([int compare(Touch a, Touch b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, Touch element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
Touch removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -23240,6 +23330,10 @@ class Uint16Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
int max([int compare(int a, int b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, int element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
int removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -23461,6 +23555,10 @@ class Uint32Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
int max([int compare(int a, int b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, int element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
int removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -23682,6 +23780,10 @@ class Uint8Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
int max([int compare(int a, int b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, int element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
int removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -23900,6 +24002,10 @@ class Uint8ClampedArray extends Uint8Array implements JavaScriptIndexingBehavior
int max([int compare(int a, int b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, int element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
int removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -27797,6 +27903,10 @@ class _ClientRectList implements JavaScriptIndexingBehavior, List<Rect> native "
Rect max([int compare(Rect a, Rect b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, Rect element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
Rect removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -27999,6 +28109,10 @@ class _CssRuleList implements JavaScriptIndexingBehavior, List<CssRule> native "
CssRule max([int compare(CssRule a, CssRule b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, CssRule element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
CssRule removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -28201,6 +28315,10 @@ class _CssValueList extends CssValue implements List<CssValue>, JavaScriptIndexi
CssValue max([int compare(CssValue a, CssValue b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, CssValue element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
CssValue removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -28403,6 +28521,10 @@ class _EntryArray implements JavaScriptIndexingBehavior, List<Entry> native "*En
Entry max([int compare(Entry a, Entry b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, Entry element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
Entry removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -28605,6 +28727,10 @@ class _EntryArraySync implements JavaScriptIndexingBehavior, List<EntrySync> nat
EntrySync max([int compare(EntrySync a, EntrySync b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, EntrySync element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
EntrySync removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -28807,6 +28933,10 @@ class _GamepadList implements JavaScriptIndexingBehavior, List<Gamepad> native "
Gamepad max([int compare(Gamepad a, Gamepad b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, Gamepad element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
Gamepad removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -29072,6 +29202,10 @@ class _NamedNodeMap implements JavaScriptIndexingBehavior, List<Node> native "*N
Node max([int compare(Node a, Node b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, Node element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
Node removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -29298,6 +29432,10 @@ class _SpeechInputResultList implements JavaScriptIndexingBehavior, List<SpeechI
SpeechInputResult max([int compare(SpeechInputResult a, SpeechInputResult b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, SpeechInputResult element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
SpeechInputResult removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -29500,6 +29638,10 @@ class _SpeechRecognitionResultList implements JavaScriptIndexingBehavior, List<S
SpeechRecognitionResult max([int compare(SpeechRecognitionResult a, SpeechRecognitionResult b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, SpeechRecognitionResult element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
SpeechRecognitionResult removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -29702,6 +29844,10 @@ class _StyleSheetList implements JavaScriptIndexingBehavior, List<StyleSheet> na
StyleSheet max([int compare(StyleSheet a, StyleSheet b)]) =>
IterableMixinWorkaround.max(this, compare);
+ void insert(int index, StyleSheet element) {
+ throw new UnsupportedError("Cannot add to immutable List.");
+ }
+
StyleSheet removeAt(int pos) {
throw new UnsupportedError("Cannot remove from immutable List.");
}
@@ -32624,6 +32770,8 @@ class _WrappedList<E> implements List<E> {
int lastIndexOf(E element, [int start]) => _list.lastIndexOf(element, start);
+ void insert(int index, E element) => _list.insert(index, element);
+
E removeAt(int index) => _list.removeAt(index);
E removeLast() => _list.removeLast();
« no previous file with comments | « sdk/lib/core/list.dart ('k') | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698