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

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

Issue 11316059: Add List.first. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add dart2js interceptor and add test. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/core/sequences.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 283b1c82b2e471ea99417c66c24ff7a260ca1120..b55f881592fa19f746858bdee0200ed158dc1cb6 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -5747,6 +5747,8 @@ class DOMMimeTypeArray implements JavaScriptIndexingBehavior, List<DOMMimeType>
return _Lists.lastIndexOf(this, element, start);
}
+ DOMMimeType get first => this[0];
+
DOMMimeType get last => this[length - 1];
DOMMimeType removeLast() {
@@ -5886,6 +5888,8 @@ class DOMPluginArray implements JavaScriptIndexingBehavior, List<DOMPlugin> nati
return _Lists.lastIndexOf(this, element, start);
}
+ DOMPlugin get first => this[0];
+
DOMPlugin get last => this[length - 1];
DOMPlugin removeLast() {
@@ -7235,6 +7239,11 @@ class _ChildrenElementList implements List {
return result;
}
+ Element get first {
+ return _element.$dom_firstElementChild;
+ }
+
+
Element get last {
return _element.$dom_lastElementChild;
}
@@ -7249,10 +7258,6 @@ class _FrozenElementList implements List {
_FrozenElementList._wrap(this._nodeList);
- Element get first {
- return _nodeList[0];
- }
-
bool contains(Element element) {
for (Element el in this) {
if (el == element) return true;
@@ -7361,6 +7366,8 @@ class _FrozenElementList implements List {
throw new UnsupportedError('');
}
+ Element get first => _nodeList.first;
+
Element get last => _nodeList.last;
}
@@ -9015,6 +9022,8 @@ class Float32Array extends ArrayBufferView implements JavaScriptIndexingBehavior
return _Lists.lastIndexOf(this, element, start);
}
+ num get first => this[0];
+
num get last => this[length - 1];
num removeLast() {
@@ -9124,6 +9133,8 @@ class Float64Array extends ArrayBufferView implements JavaScriptIndexingBehavior
return _Lists.lastIndexOf(this, element, start);
}
+ num get first => this[0];
+
num get last => this[length - 1];
num removeLast() {
@@ -9490,6 +9501,8 @@ class HTMLAllCollection implements JavaScriptIndexingBehavior, List<Node> native
return _Lists.lastIndexOf(this, element, start);
}
+ Node get first => this[0];
+
Node get last => this[length - 1];
Node removeLast() {
@@ -9593,6 +9606,8 @@ class HTMLCollection implements JavaScriptIndexingBehavior, List<Node> native "*
return _Lists.lastIndexOf(this, element, start);
}
+ Node get first => this[0];
+
Node get last => this[length - 1];
Node removeLast() {
@@ -11245,6 +11260,8 @@ class Int16Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
return _Lists.lastIndexOf(this, element, start);
}
+ int get first => this[0];
+
int get last => this[length - 1];
int removeLast() {
@@ -11354,6 +11371,8 @@ class Int32Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
return _Lists.lastIndexOf(this, element, start);
}
+ int get first => this[0];
+
int get last => this[length - 1];
int removeLast() {
@@ -11463,6 +11482,8 @@ class Int8Array extends ArrayBufferView implements JavaScriptIndexingBehavior, L
return _Lists.lastIndexOf(this, element, start);
}
+ int get first => this[0];
+
int get last => this[length - 1];
int removeLast() {
@@ -13607,6 +13628,8 @@ class NamedNodeMap implements JavaScriptIndexingBehavior, List<Node> native "*Na
return _Lists.lastIndexOf(this, element, start);
}
+ Node get first => this[0];
+
Node get last => this[length - 1];
Node removeLast() {
@@ -14143,6 +14166,8 @@ class _ListWrapper<E> implements List<E> {
E removeLast() => _list.removeLast();
+ E get first => _list.first;
+
E get last => _list.last;
List<E> getRange(int start, int rangeLength) =>
@@ -14156,8 +14181,6 @@ class _ListWrapper<E> implements List<E> {
void insertRange(int start, int rangeLength, [E initialValue = null]) =>
_list.insertRange(start, rangeLength, initialValue);
-
- E get first => _list[0];
}
/**
@@ -15923,6 +15946,8 @@ class SQLResultSetRowList implements JavaScriptIndexingBehavior, List<Map> nativ
return _Lists.lastIndexOf(this, element, start);
}
+ Map get first => this[0];
+
Map get last => this[length - 1];
Map removeLast() {
@@ -16437,6 +16462,8 @@ class SourceBufferList extends EventTarget implements JavaScriptIndexingBehavior
return _Lists.lastIndexOf(this, element, start);
}
+ SourceBuffer get first => this[0];
+
SourceBuffer get last => this[length - 1];
SourceBuffer removeLast() {
@@ -16590,6 +16617,8 @@ class SpeechGrammarList implements JavaScriptIndexingBehavior, List<SpeechGramma
return _Lists.lastIndexOf(this, element, start);
}
+ SpeechGrammar get first => this[0];
+
SpeechGrammar get last => this[length - 1];
SpeechGrammar removeLast() {
@@ -17609,6 +17638,8 @@ class TextTrackCueList implements List<TextTrackCue>, JavaScriptIndexingBehavior
return _Lists.lastIndexOf(this, element, start);
}
+ TextTrackCue get first => this[0];
+
TextTrackCue get last => this[length - 1];
TextTrackCue removeLast() {
@@ -17715,6 +17746,8 @@ class TextTrackList extends EventTarget implements JavaScriptIndexingBehavior, L
return _Lists.lastIndexOf(this, element, start);
}
+ TextTrack get first => this[0];
+
TextTrack get last => this[length - 1];
TextTrack removeLast() {
@@ -17939,6 +17972,8 @@ class TouchList implements JavaScriptIndexingBehavior, List<Touch> native "*Touc
return _Lists.lastIndexOf(this, element, start);
}
+ Touch get first => this[0];
+
Touch get last => this[length - 1];
Touch removeLast() {
@@ -18213,6 +18248,8 @@ class Uint16Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
return _Lists.lastIndexOf(this, element, start);
}
+ int get first => this[0];
+
int get last => this[length - 1];
int removeLast() {
@@ -18322,6 +18359,8 @@ class Uint32Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
return _Lists.lastIndexOf(this, element, start);
}
+ int get first => this[0];
+
int get last => this[length - 1];
int removeLast() {
@@ -18431,6 +18470,8 @@ class Uint8Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
return _Lists.lastIndexOf(this, element, start);
}
+ int get first => this[0];
+
int get last => this[length - 1];
int removeLast() {
@@ -20617,6 +20658,8 @@ class _CSSRuleList implements JavaScriptIndexingBehavior, List<CSSRule> native "
return _Lists.lastIndexOf(this, element, start);
}
+ CSSRule get first => this[0];
+
CSSRule get last => this[length - 1];
CSSRule removeLast() {
@@ -20714,6 +20757,8 @@ class _CSSValueList extends CSSValue implements List<CSSValue>, JavaScriptIndexi
return _Lists.lastIndexOf(this, element, start);
}
+ CSSValue get first => this[0];
+
CSSValue get last => this[length - 1];
CSSValue removeLast() {
@@ -20811,6 +20856,8 @@ class _ClientRectList implements JavaScriptIndexingBehavior, List<ClientRect> na
return _Lists.lastIndexOf(this, element, start);
}
+ ClientRect get first => this[0];
+
ClientRect get last => this[length - 1];
ClientRect removeLast() {
@@ -20917,6 +20964,8 @@ class _DOMStringList implements JavaScriptIndexingBehavior, List<String> native
return _Lists.lastIndexOf(this, element, start);
}
+ String get first => this[0];
+
String get last => this[length - 1];
String removeLast() {
@@ -21339,6 +21388,8 @@ class _EntryArray implements JavaScriptIndexingBehavior, List<Entry> native "*En
return _Lists.lastIndexOf(this, element, start);
}
+ Entry get first => this[0];
+
Entry get last => this[length - 1];
Entry removeLast() {
@@ -21436,6 +21487,8 @@ class _EntryArraySync implements JavaScriptIndexingBehavior, List<EntrySync> nat
return _Lists.lastIndexOf(this, element, start);
}
+ EntrySync get first => this[0];
+
EntrySync get last => this[length - 1];
EntrySync removeLast() {
@@ -21542,6 +21595,8 @@ class _FileList implements JavaScriptIndexingBehavior, List<File> native "*FileL
return _Lists.lastIndexOf(this, element, start);
}
+ File get first => this[0];
+
File get last => this[length - 1];
File removeLast() {
@@ -21668,6 +21723,8 @@ class _GamepadList implements JavaScriptIndexingBehavior, List<Gamepad> native "
return _Lists.lastIndexOf(this, element, start);
}
+ Gamepad get first => this[0];
+
Gamepad get last => this[length - 1];
Gamepad removeLast() {
@@ -21818,6 +21875,8 @@ class _MediaStreamList implements JavaScriptIndexingBehavior, List<MediaStream>
return _Lists.lastIndexOf(this, element, start);
}
+ MediaStream get first => this[0];
+
MediaStream get last => this[length - 1];
MediaStream removeLast() {
@@ -22078,6 +22137,8 @@ class _SpeechInputResultList implements JavaScriptIndexingBehavior, List<SpeechI
return _Lists.lastIndexOf(this, element, start);
}
+ SpeechInputResult get first => this[0];
+
SpeechInputResult get last => this[length - 1];
SpeechInputResult removeLast() {
@@ -22184,6 +22245,8 @@ class _SpeechRecognitionResultList implements JavaScriptIndexingBehavior, List<S
return _Lists.lastIndexOf(this, element, start);
}
+ SpeechRecognitionResult get first => this[0];
+
SpeechRecognitionResult get last => this[length - 1];
SpeechRecognitionResult removeLast() {
@@ -22281,6 +22344,8 @@ class _StyleSheetList implements JavaScriptIndexingBehavior, List<StyleSheet> na
return _Lists.lastIndexOf(this, element, start);
}
+ StyleSheet get first => this[0];
+
StyleSheet get last => this[length - 1];
StyleSheet removeLast() {
@@ -22402,6 +22467,8 @@ class _WebKitAnimationList implements JavaScriptIndexingBehavior, List<Animation
return _Lists.lastIndexOf(this, element, start);
}
+ Animation get first => this[0];
+
Animation get last => this[length - 1];
Animation removeLast() {
@@ -22778,6 +22845,8 @@ class FilteredElementList implements List {
return _filtered.lastIndexOf(element, start);
}
+ Element get first => _filtered.first;
+
Element get last => _filtered.last;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
« no previous file with comments | « sdk/lib/core/sequences.dart ('k') | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698