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

Unified Diff: test/codegen/expect/collection/algorithms.js

Issue 1524843002: JS: Format if statements with no else on a single line (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: rebased Created 5 years 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 | « test/codegen/expect/closure.js ('k') | test/codegen/expect/collection/iterable_zip.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen/expect/collection/algorithms.js
diff --git a/test/codegen/expect/collection/algorithms.js b/test/codegen/expect/collection/algorithms.js
index dd35473bd345c0179bf4df333fe78afbd3482c5e..cb7cf104803b7f88fcdab7e05b92d84e94d245d1 100644
--- a/test/codegen/expect/collection/algorithms.js
+++ b/test/codegen/expect/collection/algorithms.js
@@ -13,8 +13,7 @@ dart_library.library('collection/algorithms', null, /* Imports */[
let mid = dart.notNull(min) + (dart.notNull(max) - dart.notNull(min) >> 1);
let element = list[dartx.get](mid);
let comp = element[dartx.compareTo](key);
- if (comp == 0)
- return mid;
+ if (comp == 0) return mid;
if (dart.notNull(comp) < 0) {
min = dart.notNull(mid) + 1;
} else {
@@ -35,8 +34,7 @@ dart_library.library('collection/algorithms', null, /* Imports */[
let mid = dart.notNull(min) + (dart.notNull(max) - dart.notNull(min) >> 1);
let element = sortedList[dartx.get](mid);
let comp = dart.dcall(compare, element, key);
- if (comp == 0)
- return mid;
+ if (comp == 0) return mid;
if (dart.notNull(comp) < 0) {
min = dart.notNull(mid) + 1;
} else {
@@ -47,13 +45,10 @@ dart_library.library('collection/algorithms', null, /* Imports */[
}
dart.fn(binarySearch, core.int, [core.List, dart.dynamic], {compare: dart.functionType(core.int, [dart.dynamic, dart.dynamic])});
function shuffle(list, start, end) {
- if (start === void 0)
- start = 0;
- if (end === void 0)
- end = null;
+ if (start === void 0) start = 0;
+ if (end === void 0) end = null;
let random = math.Random.new();
- if (end == null)
- end = list[dartx.length];
+ if (end == null) end = list[dartx.length];
let length = dart.notNull(end) - dart.notNull(start);
while (dart.notNull(length) > 1) {
let pos = random.nextInt(length);
@@ -65,12 +60,9 @@ dart_library.library('collection/algorithms', null, /* Imports */[
}
dart.fn(shuffle, dart.void, [core.List], [core.int, core.int]);
function reverse(list, start, end) {
- if (start === void 0)
- start = 0;
- if (end === void 0)
- end = null;
- if (end == null)
- end = list[dartx.length];
+ if (start === void 0) start = 0;
+ if (end === void 0) end = null;
+ if (end == null) end = list[dartx.length];
_reverse(list, start, end);
}
dart.fn(reverse, dart.void, [core.List], [core.int, core.int]);
@@ -86,10 +78,8 @@ dart_library.library('collection/algorithms', null, /* Imports */[
let compare = opts && 'compare' in opts ? opts.compare : null;
let start = opts && 'start' in opts ? opts.start : 0;
let end = opts && 'end' in opts ? opts.end : null;
- if (end == null)
- end = list[dartx.length];
- if (compare == null)
- compare = core.Comparable.compare;
+ if (end == null) end = list[dartx.length];
+ if (compare == null) compare = core.Comparable.compare;
_insertionSort(list, compare, start, end, dart.notNull(start) + 1);
}
dart.fn(insertionSort, dart.void, [core.List], {compare: dart.functionType(core.int, [dart.dynamic, dart.dynamic]), start: core.int, end: core.int});
@@ -117,13 +107,10 @@ dart_library.library('collection/algorithms', null, /* Imports */[
let start = opts && 'start' in opts ? opts.start : 0;
let end = opts && 'end' in opts ? opts.end : null;
let compare = opts && 'compare' in opts ? opts.compare : null;
- if (end == null)
- end = list[dartx.length];
- if (compare == null)
- compare = core.Comparable.compare;
+ if (end == null) end = list[dartx.length];
+ if (compare == null) compare = core.Comparable.compare;
let length = dart.notNull(end) - dart.notNull(start);
- if (dart.notNull(length) < 2)
- return;
+ if (dart.notNull(length) < 2) return;
if (dart.notNull(length) < dart.notNull(_MERGE_SORT_LIMIT)) {
_insertionSort(list, compare, start, end, dart.notNull(start) + 1);
return;
@@ -140,8 +127,7 @@ dart_library.library('collection/algorithms', null, /* Imports */[
dart.fn(mergeSort, dart.void, [core.List], {start: core.int, end: core.int, compare: dart.functionType(core.int, [dart.dynamic, dart.dynamic])});
function _movingInsertionSort(list, compare, start, end, target, targetOffset) {
let length = dart.notNull(end) - dart.notNull(start);
- if (length == 0)
- return;
+ if (length == 0) return;
target[dartx.set](targetOffset, list[dartx.get](start));
for (let i = 1; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i) + 1) {
let element = list[dartx.get](dart.notNull(start) + dart.notNull(i));
@@ -197,8 +183,7 @@ dart_library.library('collection/algorithms', null, /* Imports */[
targetOffset = dart.notNull(x) + 1;
return x;
})(), firstElement);
- if (cursor1 == firstEnd)
- break;
+ if (cursor1 == firstEnd) break;
firstElement = firstList[dartx.get]((() => {
let x = cursor1;
cursor1 = dart.notNull(x) + 1;
« no previous file with comments | « test/codegen/expect/closure.js ('k') | test/codegen/expect/collection/iterable_zip.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698