9cf5a077e9
it was already decent, but this should plug the two biggest holes: source maps and maps with non-string keys R=vsm@google.com Review URL: https://codereview.chromium.org/1013223002
15 lines
446 B
Dart
15 lines
446 B
Dart
import 'dart:math' show Random;
|
|
main() {
|
|
// Uses a JS object literal
|
|
print({ '1': 2, '3': 4, '5': 6 });
|
|
// Uses array literal
|
|
print({ 1: 2, 3: 4, 5: 6 });
|
|
// Uses ES6 enhanced object literal
|
|
print({ '1': 2, '${new Random().nextInt(2) + 2}': 4, '5': 6 });
|
|
String x = '3';
|
|
// Could use enhanced object literal if we knew `x` was not null
|
|
print({ '1': 2, x: 4, '5': 6 });
|
|
// Array literal
|
|
print({ '1': 2, null: 4, '5': 6 });
|
|
}
|