| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Test file for testing source mappings of operations. | 5 // Test file for testing source mappings of operations. |
| 6 | 6 |
| 7 var counter = 0; | 7 var counter = 0; |
| 8 | 8 |
| 9 void record(result) { | 9 void record(result) { |
| 10 counter++; | 10 counter++; |
| 11 } | 11 } |
| 12 | 12 |
| 13 main(args) { | 13 main(args) { |
| 14 counter++; | 14 counter++; |
| 15 operations(args.length > 0, | 15 operations(args.length > 0, 0, 1.5, args[0], new Complex(0, 1), |
| 16 0, 1.5, args[0], new Complex(0, 1), new Complex(1.5, 2.5)); | 16 new Complex(1.5, 2.5)); |
| 17 return counter; | 17 return counter; |
| 18 } | 18 } |
| 19 | 19 |
| 20 void operations(cond, a, b, c, d, e) { | 20 void operations(cond, a, b, c, d, e) { |
| 21 if (cond) record(a + a); | 21 if (cond) record(a + a); |
| 22 if (cond) record(a + b); | 22 if (cond) record(a + b); |
| 23 if (cond) record(a + c); | 23 if (cond) record(a + c); |
| 24 if (cond) record(a + d); | 24 if (cond) record(a + d); |
| 25 if (cond) record(a + e); | 25 if (cond) record(a + e); |
| 26 if (cond) record(b + a); | 26 if (cond) record(b + a); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 51 | 51 |
| 52 const Complex(this.re, this.im); | 52 const Complex(this.re, this.im); |
| 53 | 53 |
| 54 operator +(Complex other) => new Complex(re + other.re, im + other.im); | 54 operator +(Complex other) => new Complex(re + other.re, im + other.im); |
| 55 | 55 |
| 56 // TODO(johnniwinther): Support implicit null check in '=='. | 56 // TODO(johnniwinther): Support implicit null check in '=='. |
| 57 //operator ==(Complex other) => re == other.re && im == other.im; | 57 //operator ==(Complex other) => re == other.re && im == other.im; |
| 58 | 58 |
| 59 int get hashCode => 13 * re.hashCode + 17 * im.hashCode; | 59 int get hashCode => 13 * re.hashCode + 17 * im.hashCode; |
| 60 } | 60 } |
| OLD | NEW |