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

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

Issue 1038583004: Rationalize coercions (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebase 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 class Point<T extends num> {final T x; 2 class Point<T extends num> {final T x;
3 final T y; 3 final T y;
4 const Point(T x, T y) : this.x = x, this.y = y; 4 const Point(T x, T y) : this.x = x, this.y = y;
5 String toString() => 'Point($x, $y)'; 5 String toString() => 'Point($x, $y)';
6 bool operator ==(other) { 6 bool operator ==(other) {
7 if (other is! Point) return false; 7 if (other is! Point) return false;
8 return x == other.x && y == other.y; 8 return x == other.x && y == other.y;
9 } 9 }
10 int get hashCode => _JenkinsSmiHash.hash2(x.hashCode, y.hashCode); 10 int get hashCode => _JenkinsSmiHash.hash2(x.hashCode, y.hashCode);
11 Point<T> operator +(Point<T> other) { 11 Point<T> operator +(Point<T> other) {
12 return new Point<T>(((__x0) => DEVC$RT.cast(__x0, num, T, "CastGeneral", """li ne 37, column 25 of dart:math/point.dart: """, __x0 is T, false))(x + other.x), ((__x1) => DEVC$RT.cast(__x1, num, T, "CastGeneral", """line 37, column 38 of da rt:math/point.dart: """, __x1 is T, false))(y + other.y)); 12 return new Point<T>(((__x0) => DEVC$RT.cast(__x0, num, T, "CompositeCast", """ line 37, column 25 of dart:math/point.dart: """, __x0 is T, false))(x + other.x) , ((__x1) => DEVC$RT.cast(__x1, num, T, "CompositeCast", """line 37, column 38 o f dart:math/point.dart: """, __x1 is T, false))(y + other.y));
13 } 13 }
14 Point<T> operator -(Point<T> other) { 14 Point<T> operator -(Point<T> other) {
15 return new Point<T>(((__x2) => DEVC$RT.cast(__x2, num, T, "CastGeneral", """li ne 46, column 25 of dart:math/point.dart: """, __x2 is T, false))(x - other.x), ((__x3) => DEVC$RT.cast(__x3, num, T, "CastGeneral", """line 46, column 38 of da rt:math/point.dart: """, __x3 is T, false))(y - other.y)); 15 return new Point<T>(((__x2) => DEVC$RT.cast(__x2, num, T, "CompositeCast", """ line 46, column 25 of dart:math/point.dart: """, __x2 is T, false))(x - other.x) , ((__x3) => DEVC$RT.cast(__x3, num, T, "CompositeCast", """line 46, column 38 o f dart:math/point.dart: """, __x3 is T, false))(y - other.y));
16 } 16 }
17 Point<T> operator *(num factor) { 17 Point<T> operator *(num factor) {
18 return new Point<T>(((__x4) => DEVC$RT.cast(__x4, num, T, "CastGeneral", """li ne 59, column 25 of dart:math/point.dart: """, __x4 is T, false))(x * factor), ( (__x5) => DEVC$RT.cast(__x5, num, T, "CastGeneral", """line 59, column 37 of dar t:math/point.dart: """, __x5 is T, false))(y * factor)); 18 return new Point<T>(((__x4) => DEVC$RT.cast(__x4, num, T, "CompositeCast", """ line 59, column 25 of dart:math/point.dart: """, __x4 is T, false))(x * factor), ((__x5) => DEVC$RT.cast(__x5, num, T, "CompositeCast", """line 59, column 37 of dart:math/point.dart: """, __x5 is T, false))(y * factor));
19 } 19 }
20 double get magnitude => sqrt(x * x + y * y); 20 double get magnitude => sqrt(x * x + y * y);
21 double distanceTo(Point<T> other) { 21 double distanceTo(Point<T> other) {
22 var dx = x - other.x; 22 var dx = x - other.x;
23 var dy = y - other.y; 23 var dy = y - other.y;
24 return sqrt(dx * dx + dy * dy); 24 return sqrt(dx * dx + dy * dy);
25 } 25 }
26 T squaredDistanceTo(Point<T> other) { 26 T squaredDistanceTo(Point<T> other) {
27 var dx = x - other.x; 27 var dx = x - other.x;
28 var dy = y - other.y; 28 var dy = y - other.y;
29 return ((__x6) => DEVC$RT.cast(__x6, num, T, "CastGeneral", """line 86, colum n 12 of dart:math/point.dart: """, __x6 is T, false))(dx * dx + dy * dy); 29 return ((__x6) => DEVC$RT.cast(__x6, num, T, "CompositeCast", """line 86, col umn 12 of dart:math/point.dart: """, __x6 is T, false))(dx * dx + dy * dy);
30 } 30 }
31 } 31 }
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/math/jenkins_smi_hash.dart ('k') | test/dart_codegen/expect/math/rectangle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698