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

Side by Side Diff: test/dart_codegen/expect/math/rectangle.dart

Issue 963593002: Disable formatting and add new-lines to make tests faster. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 part of dart.math; 1 part of dart.math;
2 2 abstract class _RectangleBase<T extends num> {const _RectangleBase();
3 abstract class _RectangleBase<T extends num> { 3 T get left;
4 const _RectangleBase(); 4 T get top;
5 T get left; 5 T get width;
6 T get top; 6 T get height;
7 T get width; 7 T get right => ((__x1) => DDC$RT.cast(__x1, num, T, "CastGeneral", """line 33, column 18 of dart:math/rectangle.dart: """, __x1 is T, false))(left + width);
8 T get height; 8 T get bottom => ((__x2) => DDC$RT.cast(__x2, num, T, "CastGeneral", """line 35, column 19 of dart:math/rectangle.dart: """, __x2 is T, false))(top + height);
9 T get right => ((__x1) => DDC$RT.cast(__x1, num, T, "CastGeneral", 9 String toString() {
10 """line 33, column 18 of dart:math/rectangle.dart: """, __x1 is T, 10 return 'Rectangle ($left, $top) $width x $height';
11 false))(left + width);
12 T get bottom => ((__x2) => DDC$RT.cast(__x2, num, T, "CastGeneral",
13 """line 35, column 19 of dart:math/rectangle.dart: """, __x2 is T,
14 false))(top + height);
15 String toString() {
16 return 'Rectangle ($left, $top) $width x $height';
17 } 11 }
18 bool operator ==(other) { 12 bool operator ==(other) {
19 if (other is! Rectangle) return false; 13 if (other is! Rectangle) return false;
20 return left == other.left && 14 return left == other.left && top == other.top && right == other.right && bott om == other.bottom;
21 top == other.top &&
22 right == other.right &&
23 bottom == other.bottom;
24 } 15 }
25 int get hashCode => _JenkinsSmiHash.hash4( 16 int get hashCode => _JenkinsSmiHash.hash4(left.hashCode, top.hashCode, right.ha shCode, bottom.hashCode);
26 left.hashCode, top.hashCode, right.hashCode, bottom.hashCode); 17 Rectangle<T> intersection(Rectangle<T> other) {
27 Rectangle<T> intersection(Rectangle<T> other) { 18 var x0 = max(left, other.left);
28 var x0 = max(left, other.left); 19 var x1 = min(left + width, other.left + other.width);
29 var x1 = min(left + width, other.left + other.width); 20 if (x0 <= x1) {
30 if (x0 <= x1) { 21 var y0 = max(top, other.top);
31 var y0 = max(top, other.top); 22 var y1 = min(top + height, other.top + other.height);
32 var y1 = min(top + height, other.top + other.height); 23 if (y0 <= y1) {
33 if (y0 <= y1) { 24 return new Rectangle<T>(x0, y0, x1 - x0, y1 - y0);
34 return new Rectangle<T>(x0, y0, x1 - x0, y1 - y0);
35 } 25 }
36 } 26 }
37 return null; 27 return null;
38 } 28 }
39 bool intersects(Rectangle<num> other) { 29 bool intersects(Rectangle<num> other) {
40 return (left <= other.left + other.width && 30 return (left <= other.left + other.width && other.left <= left + width && top <= other.top + other.height && other.top <= top + height);
41 other.left <= left + width &&
42 top <= other.top + other.height &&
43 other.top <= top + height);
44 } 31 }
45 Rectangle<T> boundingBox(Rectangle<T> other) { 32 Rectangle<T> boundingBox(Rectangle<T> other) {
46 var right = max(this.left + this.width, other.left + other.width); 33 var right = max(this.left + this.width, other.left + other.width);
47 var bottom = max(this.top + this.height, other.top + other.height); 34 var bottom = max(this.top + this.height, other.top + other.height);
48 var left = min(this.left, other.left); 35 var left = min(this.left, other.left);
49 var top = min(this.top, other.top); 36 var top = min(this.top, other.top);
50 return new Rectangle<T>(left, top, right - left, bottom - top); 37 return new Rectangle<T>(left, top, right - left, bottom - top);
51 } 38 }
52 bool containsRectangle(Rectangle<num> another) { 39 bool containsRectangle(Rectangle<num> another) {
53 return left <= another.left && 40 return left <= another.left && left + width >= another.left + another.width && top <= another.top && top + height >= another.top + another.height;
54 left + width >= another.left + another.width &&
55 top <= another.top &&
56 top + height >= another.top + another.height;
57 } 41 }
58 bool containsPoint(Point<num> another) { 42 bool containsPoint(Point<num> another) {
59 return another.x >= left && 43 return another.x >= left && another.x <= left + width && another.y >= top && a nother.y <= top + height;
60 another.x <= left + width &&
61 another.y >= top &&
62 another.y <= top + height;
63 } 44 }
64 Point<T> get topLeft => new Point<T>(this.left, this.top); 45 Point<T> get topLeft => new Point<T>(this.left, this.top);
65 Point<T> get topRight => new Point<T>(this.left + this.width, this.top); 46 Point<T> get topRight => new Point<T>(this.left + this.width, this.top);
66 Point<T> get bottomRight => 47 Point<T> get bottomRight => new Point<T>(this.left + this.width, this.top + thi s.height);
67 new Point<T>(this.left + this.width, this.top + this.height); 48 Point<T> get bottomLeft => new Point<T>(this.left, this.top + this.height);
68 Point<T> get bottomLeft => new Point<T>(this.left, this.top + this.height);
69 } 49 }
70 class Rectangle<T extends num> extends _RectangleBase<T> { 50 class Rectangle<T extends num> extends _RectangleBase<T> {final T left;
71 final T left; 51 final T top;
72 final T top; 52 final T width;
73 final T width; 53 final T height;
74 final T height; 54 const Rectangle(this.left, this.top, T width, T height) : this.width = (width < 0) ? -width * 0 : width, this.height = (height < 0) ? -height * 0 : height;
75 const Rectangle(this.left, this.top, T width, T height) 55 factory Rectangle.fromPoints(Point<T> a, Point<T> b) {
76 : this.width = (width < 0) ? -width * 0 : width, 56 T left = ((__x3) => DDC$RT.cast(__x3, num, T, "CastGeneral", """line 167, column 14 of dart:math/rectangle.dart: """, __x3 is T, false))(min(a.x, b.x));
77 this.height = (height < 0) ? -height * 0 : height; 57 T width = ((__x4) => DDC$RT.cast(__x4, num, T, "CastGeneral", """line 168, colu mn 15 of dart:math/rectangle.dart: """, __x4 is T, false))(max(a.x, b.x) - left) ;
78 factory Rectangle.fromPoints(Point<T> a, Point<T> b) { 58 T top = ((__x5) => DDC$RT.cast(__x5, num, T, "CastGeneral", """line 169, column 13 of dart:math/rectangle.dart: """, __x5 is T, false))(min(a.y, b.y));
79 T left = ((__x3) => DDC$RT.cast(__x3, num, T, "CastGeneral", 59 T height = ((__x6) => DDC$RT.cast(__x6, num, T, "CastGeneral", """line 170, col umn 16 of dart:math/rectangle.dart: """, __x6 is T, false))(max(a.y, b.y) - top) ;
80 """line 167, column 14 of dart:math/rectangle.dart: """, __x3 is T, 60 return new Rectangle<T>(left, top, width, height);
81 false))(min(a.x, b.x));
82 T width = ((__x4) => DDC$RT.cast(__x4, num, T, "CastGeneral",
83 """line 168, column 15 of dart:math/rectangle.dart: """, __x4 is T,
84 false))(max(a.x, b.x) - left);
85 T top = ((__x5) => DDC$RT.cast(__x5, num, T, "CastGeneral",
86 """line 169, column 13 of dart:math/rectangle.dart: """, __x5 is T,
87 false))(min(a.y, b.y));
88 T height = ((__x6) => DDC$RT.cast(__x6, num, T, "CastGeneral",
89 """line 170, column 16 of dart:math/rectangle.dart: """, __x6 is T,
90 false))(max(a.y, b.y) - top);
91 return new Rectangle<T>(left, top, width, height);
92 }
93 } 61 }
94 class MutableRectangle<T extends num> extends _RectangleBase<T>
95 implements Rectangle<T> {
96 T left;
97 T top;
98 T _width;
99 T _height;
100 MutableRectangle(this.left, this.top, T width, T height)
101 : this._width = (width < 0) ? _clampToZero(width) : width,
102 this._height = (height < 0) ? _clampToZero(height) : height;
103 factory MutableRectangle.fromPoints(Point<T> a, Point<T> b) {
104 T left = ((__x7) => DDC$RT.cast(__x7, num, T, "CastGeneral",
105 """line 228, column 14 of dart:math/rectangle.dart: """, __x7 is T,
106 false))(min(a.x, b.x));
107 T width = ((__x8) => DDC$RT.cast(__x8, num, T, "CastGeneral",
108 """line 229, column 15 of dart:math/rectangle.dart: """, __x8 is T,
109 false))(max(a.x, b.x) - left);
110 T top = ((__x9) => DDC$RT.cast(__x9, num, T, "CastGeneral",
111 """line 230, column 13 of dart:math/rectangle.dart: """, __x9 is T,
112 false))(min(a.y, b.y));
113 T height = ((__x10) => DDC$RT.cast(__x10, num, T, "CastGeneral",
114 """line 231, column 16 of dart:math/rectangle.dart: """, __x10 is T,
115 false))(max(a.y, b.y) - top);
116 return new MutableRectangle<T>(left, top, width, height);
117 }
118 T get width => _width;
119 void set width(T width) {
120 if (width < 0) width = ((__x11) => DDC$RT.cast(__x11, num, T, "CastGeneral",
121 """line 247, column 28 of dart:math/rectangle.dart: """, __x11 is T,
122 false))(_clampToZero(width));
123 _width = width;
124 }
125 T get height => _height;
126 void set height(T height) {
127 if (height < 0) height = ((__x12) => DDC$RT.cast(__x12, num, T,
128 "CastGeneral", """line 263, column 30 of dart:math/rectangle.dart: """,
129 __x12 is T, false))(_clampToZero(height));
130 _height = height;
131 }
132 } 62 }
133 num _clampToZero(num value) { 63 class MutableRectangle<T extends num> extends _RectangleBase<T> implements Rect angle<T> {T left;
134 assert(value < 0); 64 T top;
135 return -value * 0; 65 T _width;
66 T _height;
67 MutableRectangle(this.left, this.top, T width, T height) : this._width = (width < 0) ? _clampToZero(width) : width, this._height = (height < 0) ? _clampToZero( height) : height;
68 factory MutableRectangle.fromPoints(Point<T> a, Point<T> b) {
69 T left = ((__x7) => DDC$RT.cast(__x7, num, T, "CastGeneral", """line 228, column 14 of dart:math/rectangle.dart: """, __x7 is T, false))(min(a.x, b.x));
70 T width = ((__x8) => DDC$RT.cast(__x8, num, T, "CastGeneral", """line 229, colu mn 15 of dart:math/rectangle.dart: """, __x8 is T, false))(max(a.x, b.x) - left) ;
71 T top = ((__x9) => DDC$RT.cast(__x9, num, T, "CastGeneral", """line 230, column 13 of dart:math/rectangle.dart: """, __x9 is T, false))(min(a.y, b.y));
72 T height = ((__x10) => DDC$RT.cast(__x10, num, T, "CastGeneral", """line 231, c olumn 16 of dart:math/rectangle.dart: """, __x10 is T, false))(max(a.y, b.y) - t op);
73 return new MutableRectangle<T>(left, top, width, height);
136 } 74 }
75 T get width => _width;
76 void set width(T width) {
77 if (width < 0) width = ((__x11) => DDC$RT.cast(__x11, num, T, "CastGeneral", """ line 247, column 28 of dart:math/rectangle.dart: """, __x11 is T, false))(_clamp ToZero(width));
78 _width = width;
79 }
80 T get height => _height;
81 void set height(T height) {
82 if (height < 0) height = ((__x12) => DDC$RT.cast(__x12, num, T, "CastGeneral", " ""line 263, column 30 of dart:math/rectangle.dart: """, __x12 is T, false))(_cla mpToZero(height));
83 _height = height;
84 }
85 }
86 num _clampToZero(num value) {
87 assert (value < 0); return -value * 0;
88 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698