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

Unified Diff: pkg/dev_compiler/tool/input_sdk/private/js_array.dart

Issue 2752163002: Format all dart dev compiler files (Closed)
Patch Set: Created 3 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:
View side-by-side diff with in-line comments
Download patch
Index: pkg/dev_compiler/tool/input_sdk/private/js_array.dart
diff --git a/pkg/dev_compiler/tool/input_sdk/private/js_array.dart b/pkg/dev_compiler/tool/input_sdk/private/js_array.dart
index c33ca35c50a1a43811fcbea3ce9bdc8063a48418..f9546e2fe166f2bb6a0181b52f1ac64d22473384 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/js_array.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/js_array.dart
@@ -12,7 +12,6 @@ part of dart._interceptors;
*/
@JsPeerInterface(name: 'Array')
class JSArray<E> implements List<E>, JSIndexable<E> {
-
const JSArray();
/**
@@ -74,7 +73,7 @@ class JSArray<E> implements List<E>, JSIndexable<E> {
E removeAt(int index) {
checkGrowable('removeAt');
- if (index is !int) throw argumentErrorValue(index);
+ if (index is! int) throw argumentErrorValue(index);
if (index < 0 || index >= length) {
throw new RangeError.value(index);
}
@@ -83,7 +82,7 @@ class JSArray<E> implements List<E>, JSIndexable<E> {
void insert(int index, E value) {
checkGrowable('insert');
- if (index is !int) throw argumentErrorValue(index);
+ if (index is! int) throw argumentErrorValue(index);
if (index < 0 || index > length) {
throw new RangeError.value(index);
}
@@ -173,7 +172,7 @@ class JSArray<E> implements List<E>, JSIndexable<E> {
}
Iterable/*<T>*/ expand/*<T>*/(Iterable/*<T>*/ f(E element)) {
- return new ExpandIterable<E, dynamic/*=T*/>(this, f);
+ return new ExpandIterable<E, dynamic/*=T*/ >(this, f);
}
void addAll(Iterable<E> collection) {
@@ -243,7 +242,8 @@ class JSArray<E> implements List<E>, JSIndexable<E> {
return value;
}
- /*=T*/ fold/*<T>*/(/*=T*/ initialValue, /*=T*/ combine(/*=T*/ previousValue, E element)) {
+ /*=T*/ fold/*<T>*/(
+ /*=T*/ initialValue, /*=T*/ combine(/*=T*/ previousValue, E element)) {
var/*=T*/ value = initialValue;
int length = this.length;
for (int i = 0; i < length; i++) {
@@ -269,7 +269,7 @@ class JSArray<E> implements List<E>, JSIndexable<E> {
throw IterableElementError.noElement();
}
- E lastWhere(bool test(E element), { E orElse() }) {
+ E lastWhere(bool test(E element), {E orElse()}) {
int length = this.length;
for (int i = length - 1; i >= 0; i--) {
// TODO(22407): Improve bounds check elimination to allow this JS code to
@@ -313,24 +313,22 @@ class JSArray<E> implements List<E>, JSIndexable<E> {
List<E> sublist(int start, [int end]) {
checkNull(start); // TODO(ahe): This is not specified but co19 tests it.
- if (start is !int) throw argumentErrorValue(start);
+ if (start is! int) throw argumentErrorValue(start);
if (start < 0 || start > length) {
throw new RangeError.range(start, 0, length, "start");
}
if (end == null) {
end = length;
} else {
- if (end is !int) throw argumentErrorValue(end);
+ if (end is! int) throw argumentErrorValue(end);
if (end < start || end > length) {
throw new RangeError.range(end, start, length, "end");
}
}
if (start == end) return <E>[];
- return new JSArray<E>.typed(
- JS('', r'#.slice(#, #)', this, start, end));
+ return new JSArray<E>.typed(JS('', r'#.slice(#, #)', this, start, end));
}
-
Iterable<E> getRange(int start, int end) {
RangeError.checkValidRange(start, end, this.length);
return new SubListIterable<E>(this, start, end);
@@ -428,7 +426,7 @@ class JSArray<E> implements List<E>, JSIndexable<E> {
} else {
int delta = insertLength - removeLength;
int newLength = this.length + delta;
- int insertEnd = start + insertLength; // aka. end + delta.
+ int insertEnd = start + insertLength; // aka. end + delta.
this.length = newLength;
this.setRange(insertEnd, newLength, this, end);
this.setRange(start, insertEnd, replacement);
@@ -530,7 +528,7 @@ class JSArray<E> implements List<E>, JSIndexable<E> {
String toString() => ListBase.listToString(this);
- List<E> toList({ bool growable: true }) {
+ List<E> toList({bool growable: true}) {
var list = JS('', '#.slice()', this);
if (!growable) markFixedList(list);
return new JSArray<E>.typed(list);
@@ -546,7 +544,7 @@ class JSArray<E> implements List<E>, JSIndexable<E> {
void set length(int newLength) {
checkGrowable('set length');
- if (newLength is !int) {
+ if (newLength is! int) {
throw new ArgumentError.value(newLength, 'newLength');
}
// TODO(sra): Remove this test and let JavaScript throw an error.
@@ -559,14 +557,14 @@ class JSArray<E> implements List<E>, JSIndexable<E> {
}
E operator [](int index) {
- if (index is !int) throw diagnoseIndexError(this, index);
+ if (index is! int) throw diagnoseIndexError(this, index);
if (index >= length || index < 0) throw diagnoseIndexError(this, index);
return JS('var', '#[#]', this, index);
}
void operator []=(int index, E value) {
checkMutable('indexed set');
- if (index is !int) throw diagnoseIndexError(this, index);
+ if (index is! int) throw diagnoseIndexError(this, index);
if (index >= length || index < 0) throw diagnoseIndexError(this, index);
JS('void', r'#[#] = #', this, index, value);
}
@@ -588,10 +586,12 @@ class JSArray<E> implements List<E>, JSIndexable<E> {
* many assuptions in the JS backend.
*/
class JSMutableArray<E> extends JSArray<E> {}
+
class JSFixedArray<E> extends JSMutableArray<E> {}
+
class JSExtendableArray<E> extends JSMutableArray<E> {}
-class JSUnmodifiableArray<E> extends JSArray<E> {} // Already is JSIndexable.
+class JSUnmodifiableArray<E> extends JSArray<E> {} // Already is JSIndexable.
/// An [Iterator] that iterates a JSArray.
///
@@ -602,7 +602,9 @@ class ArrayIterator<E> implements Iterator<E> {
E _current;
ArrayIterator(JSArray<E> iterable)
- : _iterable = iterable, _length = iterable.length, _index = 0;
+ : _iterable = iterable,
+ _length = iterable.length,
+ _index = 0;
E get current => _current;

Powered by Google App Engine
This is Rietveld 408576698