| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // Test file for testing source mappings of operations. |
| 6 |
| 7 var counter = 0; |
| 8 |
| 9 void record(result) { |
| 10 counter++; |
| 11 } |
| 12 |
| 13 main(args) { |
| 14 counter++; |
| 15 operations(args.length > 0, |
| 16 0, 1.5, args[0], new Complex(0, 1), new Complex(1.5, 2.5)); |
| 17 return counter; |
| 18 } |
| 19 |
| 20 void operations(cond, a, b, c, d, e) { |
| 21 if (cond) record(a + a); |
| 22 if (cond) record(a + b); |
| 23 if (cond) record(a + c); |
| 24 if (cond) record(a + d); |
| 25 if (cond) record(a + e); |
| 26 if (cond) record(b + a); |
| 27 if (cond) record(b + b); |
| 28 if (cond) record(b + c); |
| 29 if (cond) record(b + d); |
| 30 if (cond) record(b + e); |
| 31 if (cond) record(c + a); |
| 32 if (cond) record(c + b); |
| 33 if (cond) record(c + c); |
| 34 if (cond) record(c + d); |
| 35 if (cond) record(c + e); |
| 36 if (cond) record(d + a); |
| 37 if (cond) record(d + b); |
| 38 if (cond) record(d + c); |
| 39 if (cond) record(d + d); |
| 40 if (cond) record(d + e); |
| 41 if (cond) record(e + a); |
| 42 if (cond) record(e + b); |
| 43 if (cond) record(e + c); |
| 44 if (cond) record(e + d); |
| 45 if (cond) record(e + e); |
| 46 } |
| 47 |
| 48 class Complex { |
| 49 final num re; |
| 50 final num im; |
| 51 |
| 52 const Complex(this.re, this.im); |
| 53 |
| 54 operator +(Complex other) => new Complex(re + other.re, im + other.im); |
| 55 |
| 56 // TODO(johnniwinther): Support implicit null check in '=='. |
| 57 //operator ==(Complex other) => re == other.re && im == other.im; |
| 58 |
| 59 int get hashCode => 13 * re.hashCode + 17 * im.hashCode; |
| 60 } |
| OLD | NEW |