| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2014, 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 // Ensure that unused empty HashMap nodes are dropped from the output. |
| 6 |
| 7 import 'package:expect/expect.dart'; |
| 8 import 'package:async_helper/async_helper.dart'; |
| 9 import 'memory_compiler.dart'; |
| 10 |
| 11 const TEST_SOURCE = const {"main.dart": r""" |
| 12 void main() { |
| 13 var x = {}; |
| 14 return; |
| 15 } |
| 16 """}; |
| 17 |
| 18 const HASHMAP_EMPTY_CONSTRUCTOR = r"LinkedHashMap_LinkedHashMap$_empty"; |
| 19 |
| 20 main() { |
| 21 var collector = new OutputCollector(); |
| 22 var compiler = compilerFor(TEST_SOURCE, outputProvider: collector); |
| 23 asyncTest(() => |
| 24 compiler.run(Uri.parse('memory:main.dart')).then((_) { |
| 25 String generated = collector.getOutput('', 'js'); |
| 26 Expect.isFalse(generated.contains(HASHMAP_EMPTY_CONSTRUCTOR)); |
| 27 }) |
| 28 ); |
| 29 } |
| OLD | NEW |