OLD | NEW |
| 1 // compile options: --source-map |
| 2 // TODO(jmesserly): more comprehensive strategy for testing the source map. |
| 3 // (this is used so we're covering it in at least one test) |
| 4 |
1 import 'dart:math' show Random; | 5 import 'dart:math' show Random; |
2 main() { | 6 main() { |
3 // Uses a JS object literal | 7 // Uses a JS object literal |
4 print({ '1': 2, '3': 4, '5': 6 }); | 8 print({ '1': 2, '3': 4, '5': 6 }); |
5 // Uses array literal | 9 // Uses array literal |
6 print({ 1: 2, 3: 4, 5: 6 }); | 10 print({ 1: 2, 3: 4, 5: 6 }); |
7 // Uses ES6 enhanced object literal | 11 // Uses ES6 enhanced object literal |
8 print({ '1': 2, '${new Random().nextInt(2) + 2}': 4, '5': 6 }); | 12 print({ '1': 2, '${new Random().nextInt(2) + 2}': 4, '5': 6 }); |
9 String x = '3'; | 13 String x = '3'; |
10 // Could use enhanced object literal if we knew `x` was not null | 14 // Could use enhanced object literal if we knew `x` was not null |
11 print({ '1': 2, x: 4, '5': 6 }); | 15 print({ '1': 2, x: 4, '5': 6 }); |
12 // Array literal | 16 // Array literal |
13 print({ '1': 2, null: 4, '5': 6 }); | 17 print({ '1': 2, null: 4, '5': 6 }); |
14 } | 18 } |
OLD | NEW |