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

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

Side-by-side diff isn't available for this file because of its large size.
Issue 11169004: Add "contains" method to Collection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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: lib/html/dart2js/html_dart2js.dart
diff --git a/lib/html/dart2js/html_dart2js.dart b/lib/html/dart2js/html_dart2js.dart
index 190145761011b021615941694e6988af3e932055..7fa8c0d8f5b685e74782bbe1008527db740df644 100644
--- a/lib/html/dart2js/html_dart2js.dart
+++ b/lib/html/dart2js/html_dart2js.dart
@@ -2242,6 +2242,8 @@ class _CSSRuleListImpl implements List<CSSRule>, JavaScriptIndexingBehavior nati
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(CSSRule element) => _Collections.contains(this, element);
sra1 2012/10/16 18:52:52 The only sane way to 'edit' this file is to regene
Lasse Reichstein Nielsen 2012/10/17 11:06:45 When I need to change this file, I have usually do
+
void forEach(void f(CSSRule element)) => _Collections.forEach(this, f);
Collection map(f(CSSRule element)) => _Collections.map(this, [], f);
@@ -7210,6 +7212,8 @@ class _CSSValueListImpl extends _CSSValueImpl implements List<CSSValue>, JavaScr
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(CSSValue element) => _Collections.contains(this, element);
+
void forEach(void f(CSSValue element)) => _Collections.forEach(this, f);
Collection map(f(CSSValue element)) => _Collections.map(this, [], f);
@@ -7938,6 +7942,8 @@ class _ClientRectListImpl implements List<ClientRect>, JavaScriptIndexingBehavio
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(ClientRect element) => _Collections.contains(this, element);
+
void forEach(void f(ClientRect element)) => _Collections.forEach(this, f);
Collection map(f(ClientRect element)) => _Collections.map(this, [], f);
@@ -8186,7 +8192,7 @@ abstract class Console {
class _ConsoleImpl
// Console is sometimes a singleton bag-of-properties without a prototype.
- implements Console
+ implements Console
sra1 2012/10/16 18:52:52 This change should not be part of this CL unless d
native "=(typeof console == 'undefined' ? {} : console)" {
final _MemoryInfoImpl memory;
@@ -8771,6 +8777,8 @@ class _DOMMimeTypeArrayImpl implements DOMMimeTypeArray, JavaScriptIndexingBehav
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(DOMMimeType element) => _Collections.contains(this, element);
+
void forEach(void f(DOMMimeType element)) => _Collections.forEach(this, f);
Collection map(f(DOMMimeType element)) => _Collections.map(this, [], f);
@@ -8939,6 +8947,8 @@ class _DOMPluginArrayImpl implements DOMPluginArray, JavaScriptIndexingBehavior
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(DOMPlugin element) => _Collections.contains(this, element);
+
void forEach(void f(DOMPlugin element)) => _Collections.forEach(this, f);
Collection map(f(DOMPlugin element)) => _Collections.map(this, [], f);
@@ -9223,6 +9233,8 @@ class _DOMStringListImpl implements DOMStringList, JavaScriptIndexingBehavior na
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(String element) => _Collections.contains(this, element);
+
void forEach(void f(String element)) => _Collections.forEach(this, f);
Collection map(f(String element)) => _Collections.map(this, [], f);
@@ -10255,6 +10267,8 @@ class _FilteredElementList implements List {
List<Element> get _filtered =>
new List.from(_childNodes.filter((n) => n is Element));
+ bool containse(Element element) => _filtered.contains(element);
floitsch 2012/10/16 14:03:19 contains (-e)
Lasse Reichstein Nielsen 2012/10/17 11:06:45 Done.
+
void forEach(void f(Element element)) {
_filtered.forEach(f);
}
@@ -10721,7 +10735,7 @@ class _DocumentImpl extends _NodeImpl implements Document
void webkitExitPointerLock() native;
- // TODO(jacobr): implement all Element methods not on Document.
+ // TODO(jacobr): implement all Element methods not on Document.
_ElementImpl query(String selectors) {
// It is fine for our RegExp to detect element id query selectors to have
@@ -11390,6 +11404,13 @@ class _ChildrenElementList implements List {
return output;
}
+ bool contains(Element element) {
+ for (_ElementImpl child in _childElements) {
+ if (child == element) return true;
+ }
+ return false;
+ }
+
void forEach(void f(Element element)) {
for (_ElementImpl element in _childElements) {
f(element);
@@ -11397,7 +11418,7 @@ class _ChildrenElementList implements List {
}
List<Element> filter(bool f(Element element)) {
- final output = [];
+ final output = <Element>[];
forEach((Element element) {
if (f(element)) {
output.add(element);
@@ -11425,7 +11446,7 @@ class _ChildrenElementList implements List {
}
Collection map(f(Element element)) {
- final out = [];
+ final out = <Element>[];
floitsch 2012/10/16 14:03:19 That looks wrong.
Lasse Reichstein Nielsen 2012/10/17 11:06:45 True. The output type is unknown.
for (Element el in this) {
out.add(f(el));
}
@@ -11528,14 +11549,21 @@ class _FrozenElementList implements List {
return _nodeList[0];
}
+ bool contains(Element element) {
+ for (Element el in this) {
+ if (el == element) return true;
+ }
+ return false;
+ }
+
void forEach(void f(Element element)) {
for (Element el in this) {
f(el);
}
}
- Collection map(f(Element element)) {
- final out = [];
+ Collection<Element> map(f(Element element)) {
+ final out = <Element>[];
floitsch 2012/10/16 14:03:19 ditto.
for (Element el in this) {
out.add(f(el));
}
@@ -11543,7 +11571,7 @@ class _FrozenElementList implements List {
}
List<Element> filter(bool f(Element element)) {
- final out = [];
+ final out = <Element>[];
for (Element el in this) {
if (f(el)) out.add(el);
}
@@ -11834,6 +11862,8 @@ class _CssClassSet implements CSSClassSet {
// interface Iterable - END
// interface Collection - BEGIN
+ bool contains(String element) => _read().contains(element);
+
void forEach(void f(String element)) {
_read().forEach(f);
}
@@ -12666,6 +12696,8 @@ class _EntryArrayImpl implements List<Entry>, JavaScriptIndexingBehavior native
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(Entry element) => _Collections.contains(this, element);
+
void forEach(void f(Entry element)) => _Collections.forEach(this, f);
Collection map(f(Entry element)) => _Collections.map(this, [], f);
@@ -12754,6 +12786,8 @@ class _EntryArraySyncImpl implements List<EntrySync>, JavaScriptIndexingBehavior
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(EntrySync element) => _Collections.contains(this, element);
+
void forEach(void f(EntrySync element)) => _Collections.forEach(this, f);
Collection map(f(EntrySync element)) => _Collections.map(this, [], f);
@@ -13574,6 +13608,8 @@ class _FileListImpl implements List<File>, JavaScriptIndexingBehavior native "*F
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(File element) => _Collections.contains(this, element);
+
void forEach(void f(File element)) => _Collections.forEach(this, f);
Collection map(f(File element)) => _Collections.map(this, [], f);
@@ -13952,7 +13988,7 @@ abstract class Float32Array implements ArrayBufferView, List<num> {
factory Float32Array.fromList(List<num> list) =>
_TypedArrayFactoryProvider.createFloat32Array_fromList(list);
- factory Float32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
+ factory Float32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
_TypedArrayFactoryProvider.createFloat32Array_fromBuffer(buffer, byteOffset, length);
static const int BYTES_PER_ELEMENT = 4;
@@ -14000,6 +14036,8 @@ class _Float32ArrayImpl extends _ArrayBufferViewImpl implements Float32Array, Li
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(num element) => _Collections.contains(this, element);
+
void forEach(void f(num element)) => _Collections.forEach(this, f);
Collection map(f(num element)) => _Collections.map(this, [], f);
@@ -14069,7 +14107,7 @@ abstract class Float64Array implements ArrayBufferView, List<num> {
factory Float64Array.fromList(List<num> list) =>
_TypedArrayFactoryProvider.createFloat64Array_fromList(list);
- factory Float64Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
+ factory Float64Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
_TypedArrayFactoryProvider.createFloat64Array_fromBuffer(buffer, byteOffset, length);
static const int BYTES_PER_ELEMENT = 8;
@@ -14117,6 +14155,8 @@ class _Float64ArrayImpl extends _ArrayBufferViewImpl implements Float64Array, Li
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(num element) => _Collections.contains(this, element);
+
void forEach(void f(num element)) => _Collections.forEach(this, f);
Collection map(f(num element)) => _Collections.map(this, [], f);
@@ -14546,6 +14586,8 @@ class _GamepadListImpl implements List<Gamepad>, JavaScriptIndexingBehavior nati
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(Gamepad element) => _Collections.contains(this, element);
+
void forEach(void f(Gamepad element)) => _Collections.forEach(this, f);
Collection map(f(Gamepad element)) => _Collections.map(this, [], f);
@@ -14738,6 +14780,8 @@ class _HTMLAllCollectionImpl implements HTMLAllCollection, JavaScriptIndexingBeh
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(Node element) => _Collections.contains(this, element);
+
void forEach(void f(Node element)) => _Collections.forEach(this, f);
Collection map(f(Node element)) => _Collections.map(this, [], f);
@@ -14848,6 +14892,8 @@ class _HTMLCollectionImpl implements HTMLCollection, JavaScriptIndexingBehavior
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(Node element) => _Collections.contains(this, element);
+
void forEach(void f(Node element)) => _Collections.forEach(this, f);
Collection map(f(Node element)) => _Collections.map(this, [], f);
@@ -17095,7 +17141,7 @@ abstract class Int16Array implements ArrayBufferView, List<int> {
factory Int16Array.fromList(List<int> list) =>
_TypedArrayFactoryProvider.createInt16Array_fromList(list);
- factory Int16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
+ factory Int16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
_TypedArrayFactoryProvider.createInt16Array_fromBuffer(buffer, byteOffset, length);
static const int BYTES_PER_ELEMENT = 2;
@@ -17143,6 +17189,8 @@ class _Int16ArrayImpl extends _ArrayBufferViewImpl implements Int16Array, List<i
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(int element) => _Collections.contains(this, element);
+
void forEach(void f(int element)) => _Collections.forEach(this, f);
Collection map(f(int element)) => _Collections.map(this, [], f);
@@ -17212,7 +17260,7 @@ abstract class Int32Array implements ArrayBufferView, List<int> {
factory Int32Array.fromList(List<int> list) =>
_TypedArrayFactoryProvider.createInt32Array_fromList(list);
- factory Int32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
+ factory Int32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
_TypedArrayFactoryProvider.createInt32Array_fromBuffer(buffer, byteOffset, length);
static const int BYTES_PER_ELEMENT = 4;
@@ -17260,6 +17308,8 @@ class _Int32ArrayImpl extends _ArrayBufferViewImpl implements Int32Array, List<i
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(int element) => _Collections.contains(this, element);
+
void forEach(void f(int element)) => _Collections.forEach(this, f);
Collection map(f(int element)) => _Collections.map(this, [], f);
@@ -17329,7 +17379,7 @@ abstract class Int8Array implements ArrayBufferView, List<int> {
factory Int8Array.fromList(List<int> list) =>
_TypedArrayFactoryProvider.createInt8Array_fromList(list);
- factory Int8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
+ factory Int8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
_TypedArrayFactoryProvider.createInt8Array_fromBuffer(buffer, byteOffset, length);
static const int BYTES_PER_ELEMENT = 1;
@@ -17377,6 +17427,8 @@ class _Int8ArrayImpl extends _ArrayBufferViewImpl implements Int8Array, List<int
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(int element) => _Collections.contains(this, element);
+
void forEach(void f(int element)) => _Collections.forEach(this, f);
Collection map(f(int element)) => _Collections.map(this, [], f);
@@ -19873,6 +19925,8 @@ class _MediaStreamListImpl implements List<MediaStream>, JavaScriptIndexingBehav
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(MediaStream element) => _Collections.contains(this, element);
+
void forEach(void f(MediaStream element)) => _Collections.forEach(this, f);
Collection map(f(MediaStream element)) => _Collections.map(this, [], f);
@@ -20862,6 +20916,8 @@ class _NamedNodeMapImpl implements NamedNodeMap, JavaScriptIndexingBehavior nati
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(Node element) => _Collections.contains(this, element);
+
void forEach(void f(Node element)) => _Collections.forEach(this, f);
Collection map(f(Node element)) => _Collections.map(this, [], f);
@@ -21306,6 +21362,8 @@ class _ChildNodeListLazy implements List {
// TODO(jacobr): We can implement these methods much more efficiently by
// looking up the nodeList only once instead of once per iteration.
+ bool contains(Node element) => _Collections.contains(this, element);
+
void forEach(void f(Node element)) => _Collections.forEach(this, f);
Collection map(f(Node element)) => _Collections.map(this, [], f);
@@ -21526,6 +21584,8 @@ class _ListWrapper<E> implements List<E> {
Iterator<E> iterator() => _list.iterator();
+ bool contains(E element) => _list.contains(element);
+
void forEach(void f(E element)) => _list.forEach(f);
Collection map(f(E element)) => _list.map(f);
@@ -21641,6 +21701,8 @@ class _NodeListImpl implements NodeList, JavaScriptIndexingBehavior native "*Nod
_parent.$dom_replaceChild(value, this[index]);
}
+ bool contains(Node element) => _Collections.contains(this, element);
+
void forEach(void f(Node element)) => _Collections.forEach(this, f);
Collection map(f(Node element)) => _Collections.map(this, [], f);
@@ -23885,6 +23947,8 @@ class _SQLResultSetRowListImpl implements SQLResultSetRowList, JavaScriptIndexin
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(Map element) => _Collections.contains(this, element);
+
void forEach(void f(Map element)) => _Collections.forEach(this, f);
Collection map(f(Map element)) => _Collections.map(this, [], f);
@@ -24390,6 +24454,8 @@ class _SVGAnimatedLengthListImpl implements SVGAnimatedLengthList, JavaScriptInd
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(SVGAnimatedLength element) => _Collections.contains(this, element);
+
void forEach(void f(SVGAnimatedLength element)) => _Collections.forEach(this, f);
Collection map(f(SVGAnimatedLength element)) => _Collections.map(this, [], f);
@@ -24515,6 +24581,8 @@ class _SVGAnimatedNumberListImpl implements SVGAnimatedNumberList, JavaScriptInd
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(SVGAnimatedNumber element) => _Collections.contains(this, element);
+
void forEach(void f(SVGAnimatedNumber element)) => _Collections.forEach(this, f);
Collection map(f(SVGAnimatedNumber element)) => _Collections.map(this, [], f);
@@ -24684,6 +24752,8 @@ class _SVGAnimatedTransformListImpl implements SVGAnimatedTransformList, JavaScr
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(SVGAnimateTransformElement element) => _Collections.contains(this, element);
+
void forEach(void f(SVGAnimateTransformElement element)) => _Collections.forEach(this, f);
Collection map(f(SVGAnimateTransformElement element)) => _Collections.map(this, [], f);
@@ -25536,6 +25606,8 @@ class _SVGElementInstanceListImpl implements List<SVGElementInstance>, JavaScrip
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(SVGElementInstance element) => _Collections.contains(this, element);
+
void forEach(void f(SVGElementInstance element)) => _Collections.forEach(this, f);
Collection map(f(SVGElementInstance element)) => _Collections.map(this, [], f);
@@ -27556,6 +27628,8 @@ class _SVGLengthListImpl implements SVGLengthList, JavaScriptIndexingBehavior na
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(SVGLength element) => _Collections.contains(this, element);
+
void forEach(void f(SVGLength element)) => _Collections.forEach(this, f);
Collection map(f(SVGLength element)) => _Collections.map(this, [], f);
@@ -28150,6 +28224,8 @@ class _SVGNumberListImpl implements SVGNumberList, JavaScriptIndexingBehavior na
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(SVGNumber element) => _Collections.contains(this, element);
+
void forEach(void f(SVGNumber element)) => _Collections.forEach(this, f);
Collection map(f(SVGNumber element)) => _Collections.map(this, [], f);
@@ -29065,6 +29141,8 @@ class _SVGPathSegListImpl implements SVGPathSegList, JavaScriptIndexingBehavior
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(SVGPathSeg element) => _Collections.contains(this, element);
+
void forEach(void f(SVGPathSeg element)) => _Collections.forEach(this, f);
Collection map(f(SVGPathSeg element)) => _Collections.map(this, [], f);
@@ -30096,6 +30174,8 @@ class _SVGStringListImpl implements SVGStringList, JavaScriptIndexingBehavior na
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(String element) => _Collections.contains(this, element);
+
void forEach(void f(String element)) => _Collections.forEach(this, f);
Collection map(f(String element)) => _Collections.map(this, [], f);
@@ -30749,6 +30829,8 @@ class _SVGTransformListImpl implements SVGTransformList, JavaScriptIndexingBehav
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(SVGTransform element) => _Collections.contains(this, element);
+
void forEach(void f(SVGTransform element)) => _Collections.forEach(this, f);
Collection map(f(SVGTransform element)) => _Collections.map(this, [], f);
@@ -31688,6 +31770,8 @@ class _SourceBufferListImpl implements SourceBufferList, JavaScriptIndexingBehav
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(SourceBuffer element) => _Collections.contains(this, element);
+
void forEach(void f(SourceBuffer element)) => _Collections.forEach(this, f);
Collection map(f(SourceBuffer element)) => _Collections.map(this, [], f);
@@ -31872,6 +31956,8 @@ class _SpeechGrammarListImpl implements SpeechGrammarList, JavaScriptIndexingBeh
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(SpeechGrammar element) => _Collections.contains(this, element);
+
void forEach(void f(SpeechGrammar element)) => _Collections.forEach(this, f);
Collection map(f(SpeechGrammar element)) => _Collections.map(this, [], f);
@@ -32003,6 +32089,8 @@ class _SpeechInputResultListImpl implements List<SpeechInputResult>, JavaScriptI
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(SpeechInputResult element) => _Collections.contains(this, element);
+
void forEach(void f(SpeechInputResult element)) => _Collections.forEach(this, f);
Collection map(f(SpeechInputResult element)) => _Collections.map(this, [], f);
@@ -32339,6 +32427,8 @@ class _SpeechRecognitionResultListImpl implements List<SpeechRecognitionResult>,
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(SpeechRecognitionResult element) => _Collections.contains(this, element);
+
void forEach(void f(SpeechRecognitionResult element)) => _Collections.forEach(this, f);
Collection map(f(SpeechRecognitionResult element)) => _Collections.map(this, [], f);
@@ -32497,13 +32587,13 @@ class _StorageImpl implements Storage native "*Storage" {
}
Collection<String> getKeys() {
- final keys = [];
+ final keys = <String>[];
forEach((k, v) => keys.add(k));
return keys;
}
Collection<String> getValues() {
- final values = [];
+ final values = <String>[];
forEach((k, v) => values.add(v));
return values;
}
@@ -32723,6 +32813,8 @@ class _StyleSheetListImpl implements List<StyleSheet>, JavaScriptIndexingBehavio
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(StyleSheet element) => _Collections.contains(this, element);
+
void forEach(void f(StyleSheet element)) => _Collections.forEach(this, f);
Collection map(f(StyleSheet element)) => _Collections.map(this, [], f);
@@ -33615,6 +33707,8 @@ class _TextTrackCueListImpl implements TextTrackCueList, JavaScriptIndexingBehav
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(TextTrackCue element) => _Collections.contains(this, element);
+
void forEach(void f(TextTrackCue element)) => _Collections.forEach(this, f);
Collection map(f(TextTrackCue element)) => _Collections.map(this, [], f);
@@ -33776,6 +33870,8 @@ class _TextTrackListImpl implements TextTrackList, JavaScriptIndexingBehavior na
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(TextTrack element) => _Collections.contains(this, element);
+
void forEach(void f(TextTrack element)) => _Collections.forEach(this, f);
Collection map(f(TextTrack element)) => _Collections.map(this, [], f);
@@ -34064,6 +34160,8 @@ class _TouchListImpl implements TouchList, JavaScriptIndexingBehavior native "*T
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(Touch element) => _Collections.contains(this, element);
+
void forEach(void f(Touch element)) => _Collections.forEach(this, f);
Collection map(f(Touch element)) => _Collections.map(this, [], f);
@@ -34388,7 +34486,7 @@ abstract class Uint16Array implements ArrayBufferView, List<int> {
factory Uint16Array.fromList(List<int> list) =>
_TypedArrayFactoryProvider.createUint16Array_fromList(list);
- factory Uint16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
+ factory Uint16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
_TypedArrayFactoryProvider.createUint16Array_fromBuffer(buffer, byteOffset, length);
static const int BYTES_PER_ELEMENT = 2;
@@ -34436,6 +34534,8 @@ class _Uint16ArrayImpl extends _ArrayBufferViewImpl implements Uint16Array, List
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(int element) => _Collections.contains(this, element);
+
void forEach(void f(int element)) => _Collections.forEach(this, f);
Collection map(f(int element)) => _Collections.map(this, [], f);
@@ -34505,7 +34605,7 @@ abstract class Uint32Array implements ArrayBufferView, List<int> {
factory Uint32Array.fromList(List<int> list) =>
_TypedArrayFactoryProvider.createUint32Array_fromList(list);
- factory Uint32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
+ factory Uint32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
_TypedArrayFactoryProvider.createUint32Array_fromBuffer(buffer, byteOffset, length);
static const int BYTES_PER_ELEMENT = 4;
@@ -34553,6 +34653,8 @@ class _Uint32ArrayImpl extends _ArrayBufferViewImpl implements Uint32Array, List
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(int element) => _Collections.contains(this, element);
+
void forEach(void f(int element)) => _Collections.forEach(this, f);
Collection map(f(int element)) => _Collections.map(this, [], f);
@@ -34622,7 +34724,7 @@ abstract class Uint8Array implements ArrayBufferView, List<int> {
factory Uint8Array.fromList(List<int> list) =>
_TypedArrayFactoryProvider.createUint8Array_fromList(list);
- factory Uint8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
+ factory Uint8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
_TypedArrayFactoryProvider.createUint8Array_fromBuffer(buffer, byteOffset, length);
static const int BYTES_PER_ELEMENT = 1;
@@ -34670,6 +34772,8 @@ class _Uint8ArrayImpl extends _ArrayBufferViewImpl implements Uint8Array, List<i
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(int element) => _Collections.contains(this, element);
+
void forEach(void f(int element)) => _Collections.forEach(this, f);
Collection map(f(int element)) => _Collections.map(this, [], f);
@@ -34739,7 +34843,7 @@ abstract class Uint8ClampedArray implements Uint8Array {
factory Uint8ClampedArray.fromList(List<int> list) =>
_TypedArrayFactoryProvider.createUint8ClampedArray_fromList(list);
- factory Uint8ClampedArray.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
+ factory Uint8ClampedArray.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
_TypedArrayFactoryProvider.createUint8ClampedArray_fromBuffer(buffer, byteOffset, length);
/** @domName Uint8ClampedArray.length */
@@ -36657,6 +36761,8 @@ class _WebKitAnimationListImpl implements List<Animation>, JavaScriptIndexingBeh
throw const UnsupportedOperationException("Cannot add to immutable List.");
}
+ bool contains(Animation element) => _Collections.contains(this, element);
+
void forEach(void f(Animation element)) => _Collections.forEach(this, f);
Collection map(f(Animation element)) => _Collections.map(this, [], f);
@@ -38843,6 +38949,13 @@ get _timerFactoryClosure => (int milliSeconds, void callback(Timer timer), bool
* method.
*/
class _Collections {
+ static bool contains(Iterable<Object> iterable, Object element) {
+ for (final e in iterable) {
+ if (e == element) return true;
+ }
+ return false;
+ }
+
static void forEach(Iterable<Object> iterable, void f(Object o)) {
for (final e in iterable) {
f(e);
@@ -38999,7 +39112,7 @@ class _RemoteSendPortSync implements SendPortSync {
}
static _call(int isolateId, int portId, var message) {
- var target = 'dart-port-$isolateId-$portId';
+ var target = 'dart-port-$isolateId-$portId';
// TODO(vsm): Make this re-entrant.
// TODO(vsm): Set this up set once, on the first call.
var source = '$target-result';
@@ -39064,13 +39177,13 @@ class ReceivePortSync {
static int get _isolateId {
// TODO(vsm): Make this coherent with existing isolate code.
if (_cachedIsolateId == null) {
- _cachedIsolateId = _getNewIsolateId();
+ _cachedIsolateId = _getNewIsolateId();
}
return _cachedIsolateId;
}
static String _getListenerName(isolateId, portId) =>
- 'dart-port-$isolateId-$portId';
+ 'dart-port-$isolateId-$portId';
String get _listenerName => _getListenerName(_isolateId, _portId);
void receive(callback(var message)) {
@@ -40558,7 +40671,6 @@ class _VariableSizeListIterator<T> implements Iterator<T> {
// BSD-style license that can be found in the LICENSE file.
class _Lists {
-
/**
* Returns the index in the array [a] of the given [element], starting
* the search at index [startIndex] to [endIndex] (exclusive).

Powered by Google App Engine
This is Rietveld 408576698