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

Unified Diff: lib/runtime/dart/math.js

Issue 1156993015: fixes #193, factory constructors as static methods (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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: lib/runtime/dart/math.js
diff --git a/lib/runtime/dart/math.js b/lib/runtime/dart/math.js
index 1376d169d0df3bb2dba6bee82060b60d1ffc6fe8..ad305b38545c77460cdffbebe9976e2a607c6285 100644
--- a/lib/runtime/dart/math.js
+++ b/lib/runtime/dart/math.js
@@ -88,14 +88,14 @@ var _js_helper = dart.lazyImport(_js_helper);
});
let Point = Point$();
class Random extends core.Object {
- Random(seed) {
+ static new(seed) {
if (seed === void 0)
seed = null;
return seed == null ? dart.const(new _JSRandom()) : new _Random(seed);
}
}
dart.setSignature(Random, {
- constructors: () => ({Random: [Random, [], [core.int]]})
+ constructors: () => ({new: [Random, [], [core.int]]})
});
let _RectangleBase$ = dart.generic(function(T) {
class _RectangleBase extends core.Object {
@@ -183,7 +183,7 @@ var _js_helper = dart.lazyImport(_js_helper);
this.height = dart.as(height['<'](0) ? dart.notNull(height['unary-']()) * 0 : height, T);
super._RectangleBase();
}
- fromPoints(a, b) {
+ static fromPoints(a, b) {
let left = dart.as(min(a.x, b.x), T);
let width = dart.as(max(a.x, b.x)['-'](left), T);
let top = dart.as(min(a.y, b.y), T);
@@ -191,7 +191,6 @@ var _js_helper = dart.lazyImport(_js_helper);
return new (Rectangle$(T))(left, top, width, height);
}
}
- dart.defineNamedConstructor(Rectangle, 'fromPoints');
dart.setSignature(Rectangle, {
constructors: () => ({
Rectangle: [Rectangle$(T), [T, T, T, T]],
@@ -212,7 +211,7 @@ var _js_helper = dart.lazyImport(_js_helper);
this[_height] = dart.as(height['<'](0) ? _clampToZero(height) : height, T);
super._RectangleBase();
}
- fromPoints(a, b) {
+ static fromPoints(a, b) {
let left = dart.as(min(a.x, b.x), T);
let width = dart.as(max(a.x, b.x)['-'](left), T);
let top = dart.as(min(a.y, b.y), T);
@@ -239,7 +238,6 @@ var _js_helper = dart.lazyImport(_js_helper);
}
}
MutableRectangle[dart.implements] = () => [Rectangle$(T)];
- dart.defineNamedConstructor(MutableRectangle, 'fromPoints');
dart.setSignature(MutableRectangle, {
constructors: () => ({
MutableRectangle: [MutableRectangle$(T), [T, T, T, T]],

Powered by Google App Engine
This is Rietveld 408576698