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

Unified Diff: test/codegen/expect/collection/priority_queue.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
Index: test/codegen/expect/collection/priority_queue.js
diff --git a/test/codegen/expect/collection/priority_queue.js b/test/codegen/expect/collection/priority_queue.js
index 22ff381d7bffacd61ef09caad7d0e2a8c21baf38..8bbeb1908b1bed1bd12d9a40dbb1313fd9bf813f 100644
--- a/test/codegen/expect/collection/priority_queue.js
+++ b/test/codegen/expect/collection/priority_queue.js
@@ -22,8 +22,7 @@ dart_library.library('collection/priority_queue', null, /* Imports */[
const HeapPriorityQueue$ = dart.generic(function(E) {
class HeapPriorityQueue extends core.Object {
HeapPriorityQueue(comparison) {
- if (comparison === void 0)
- comparison = null;
+ if (comparison === void 0) comparison = null;
this[_queue] = core.List$(E).new(HeapPriorityQueue$()._INITIAL_CAPACITY);
this.comparison = comparison != null ? comparison : core.Comparable.compare;
this[_length] = 0;
@@ -47,8 +46,7 @@ dart_library.library('collection/priority_queue', null, /* Imports */[
return dart.notNull(this[_locate](object)) >= 0;
}
get first() {
- if (this[_length] == 0)
- dart.throw(new core.StateError("No such element"));
+ if (this[_length] == 0) dart.throw(new core.StateError("No such element"));
return this[_queue][dartx.get](0);
}
get isEmpty() {
@@ -63,8 +61,7 @@ dart_library.library('collection/priority_queue', null, /* Imports */[
remove(element) {
dart.as(element, E);
let index = this[_locate](element);
- if (dart.notNull(index) < 0)
- return false;
+ if (dart.notNull(index) < 0) return false;
let last = this[_removeLast]();
if (dart.notNull(index) < dart.notNull(this[_length])) {
let comp = dart.dcall(this.comparison, last, element);
@@ -84,8 +81,7 @@ dart_library.library('collection/priority_queue', null, /* Imports */[
return result[dartx.take](length);
}
removeFirst() {
- if (this[_length] == 0)
- dart.throw(new core.StateError("No such element"));
+ if (this[_length] == 0) dart.throw(new core.StateError("No such element"));
let result = this[_queue][dartx.get](0);
let last = this[_removeLast]();
if (dart.notNull(this[_length]) > 0) {
@@ -112,8 +108,7 @@ dart_library.library('collection/priority_queue', null, /* Imports */[
}
[_add](element) {
dart.as(element, E);
- if (this[_length] == this[_queue][dartx.length])
- this[_grow]();
+ if (this[_length] == this[_queue][dartx.length]) this[_grow]();
this[_bubbleUp](element, (() => {
let x = this[_length];
this[_length] = dart.notNull(x) + 1;
@@ -122,15 +117,13 @@ dart_library.library('collection/priority_queue', null, /* Imports */[
}
[_locate](object) {
dart.as(object, E);
- if (this[_length] == 0)
- return -1;
+ if (this[_length] == 0) return -1;
let position = 1;
do {
let index = dart.notNull(position) - 1;
let element = this[_queue][dartx.get](index);
let comp = dart.dcall(this.comparison, element, object);
- if (comp == 0)
- return index;
+ if (comp == 0) return index;
if (dart.notNull(comp) < 0) {
let leftChildPosition = dart.notNull(position) * 2;
if (dart.notNull(leftChildPosition) <= dart.notNull(this[_length])) {
@@ -159,8 +152,7 @@ dart_library.library('collection/priority_queue', null, /* Imports */[
while (dart.notNull(index) > 0) {
let parentIndex = ((dart.notNull(index) - 1) / 2)[dartx.truncate]();
let parent = this[_queue][dartx.get](parentIndex);
- if (dart.notNull(dart.dcall(this.comparison, element, parent)) > 0)
- break;
+ if (dart.notNull(dart.dcall(this.comparison, element, parent)) > 0) break;
this[_queue][dartx.set](index, parent);
index = parentIndex;
}
@@ -205,8 +197,7 @@ dart_library.library('collection/priority_queue', null, /* Imports */[
}
[_grow]() {
let newCapacity = dart.notNull(this[_queue][dartx.length]) * 2 + 1;
- if (dart.notNull(newCapacity) < dart.notNull(HeapPriorityQueue$()._INITIAL_CAPACITY))
- newCapacity = HeapPriorityQueue$()._INITIAL_CAPACITY;
+ if (dart.notNull(newCapacity) < dart.notNull(HeapPriorityQueue$()._INITIAL_CAPACITY)) newCapacity = HeapPriorityQueue$()._INITIAL_CAPACITY;
let newQueue = core.List$(E).new(newCapacity);
newQueue[dartx.setRange](0, this[_length], this[_queue]);
this[_queue] = newQueue;
« no previous file with comments | « test/codegen/expect/collection/iterable_zip.js ('k') | test/codegen/expect/collection/src/canonicalized_map.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698