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

Unified Diff: lib/runtime/dart/math.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 | « lib/runtime/dart/js.js ('k') | lib/runtime/dart/mirrors.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/runtime/dart/math.js
diff --git a/lib/runtime/dart/math.js b/lib/runtime/dart/math.js
index 8aba78233f2e8f70d0fb1cc2c9bccff038175be9..ff40e4e5f0ce6aba5820f12203ce1a5a764d21c6 100644
--- a/lib/runtime/dart/math.js
+++ b/lib/runtime/dart/math.js
@@ -43,8 +43,7 @@ dart_library.library('dart/math', null, /* Imports */[
return `Point(${this.x}, ${this.y})`;
}
['=='](other) {
- if (!dart.is(other, Point$()))
- return false;
+ if (!dart.is(other, Point$())) return false;
return dart.equals(this.x, dart.dload(other, 'x')) && dart.equals(this.y, dart.dload(other, 'y'));
}
get hashCode() {
@@ -92,8 +91,7 @@ dart_library.library('dart/math', null, /* Imports */[
let Point = Point$();
class Random extends core.Object {
static new(seed) {
- if (seed === void 0)
- seed = null;
+ if (seed === void 0) seed = null;
return seed == null ? dart.const(new _JSRandom()) : new _Random(seed);
}
}
@@ -114,8 +112,7 @@ dart_library.library('dart/math', null, /* Imports */[
return `Rectangle (${this.left}, ${this.top}) ${this.width} x ${this.height}`;
}
['=='](other) {
- if (!dart.is(other, Rectangle))
- return false;
+ if (!dart.is(other, Rectangle)) return false;
return dart.equals(this.left, dart.dload(other, 'left')) && dart.equals(this.top, dart.dload(other, 'top')) && dart.equals(this.right, dart.dload(other, 'right')) && dart.equals(this.bottom, dart.dload(other, 'bottom'));
}
get hashCode() {
@@ -226,8 +223,7 @@ dart_library.library('dart/math', null, /* Imports */[
}
set width(width) {
dart.as(width, T);
- if (dart.notNull(width) < 0)
- width = _clampToZero(width);
+ if (dart.notNull(width) < 0) width = _clampToZero(width);
this[_width] = width;
}
get height() {
@@ -235,8 +231,7 @@ dart_library.library('dart/math', null, /* Imports */[
}
set height(height) {
dart.as(height, T);
- if (dart.notNull(height) < 0)
- height = _clampToZero(height);
+ if (dart.notNull(height) < 0) height = _clampToZero(height);
this[_height] = height;
}
}
@@ -264,48 +259,37 @@ dart_library.library('dart/math', null, /* Imports */[
const SQRT1_2 = 0.7071067811865476;
const SQRT2 = 1.4142135623730951;
function min(a, b) {
- if (!(typeof a == 'number'))
- dart.throw(new core.ArgumentError(a));
- if (!(typeof b == 'number'))
- dart.throw(new core.ArgumentError(b));
- if (dart.notNull(a) > dart.notNull(b))
- return b;
- if (dart.notNull(a) < dart.notNull(b))
- return a;
+ if (!(typeof a == 'number')) dart.throw(new core.ArgumentError(a));
+ if (!(typeof b == 'number')) dart.throw(new core.ArgumentError(b));
+ if (dart.notNull(a) > dart.notNull(b)) return b;
+ if (dart.notNull(a) < dart.notNull(b)) return a;
if (typeof b == 'number') {
if (typeof a == 'number') {
if (a == 0.0) {
return (dart.notNull(a) + dart.notNull(b)) * dart.notNull(a) * dart.notNull(b);
}
}
- if (a == 0 && dart.notNull(b[dartx.isNegative]) || dart.notNull(b[dartx.isNaN]))
- return b;
+ if (a == 0 && dart.notNull(b[dartx.isNegative]) || dart.notNull(b[dartx.isNaN])) return b;
return a;
}
return a;
}
dart.fn(min, core.num, [core.num, core.num]);
function max(a, b) {
- if (!(typeof a == 'number'))
- dart.throw(new core.ArgumentError(a));
- if (!(typeof b == 'number'))
- dart.throw(new core.ArgumentError(b));
- if (dart.notNull(a) > dart.notNull(b))
- return a;
- if (dart.notNull(a) < dart.notNull(b))
- return b;
+ if (!(typeof a == 'number')) dart.throw(new core.ArgumentError(a));
+ if (!(typeof b == 'number')) dart.throw(new core.ArgumentError(b));
+ if (dart.notNull(a) > dart.notNull(b)) return a;
+ if (dart.notNull(a) < dart.notNull(b)) return b;
if (typeof b == 'number') {
if (typeof a == 'number') {
if (a == 0.0) {
return dart.notNull(a) + dart.notNull(b);
}
}
- if (dart.notNull(b[dartx.isNaN]))
- return b;
+ if (dart.notNull(b[dartx.isNaN])) return b;
return a;
}
- if (b == 0 && dart.notNull(a[dartx.isNegative]))
- return b;
+ if (b == 0 && dart.notNull(a[dartx.isNegative])) return b;
return a;
}
dart.fn(max, core.num, [core.num, core.num]);
« no previous file with comments | « lib/runtime/dart/js.js ('k') | lib/runtime/dart/mirrors.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698