Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012, 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 // Test that parameters keep their names in the output. | |
| 5 | |
| 6 import 'dart:async'; | |
| 7 import "package:expect/expect.dart"; | |
| 8 import "package:async_helper/async_helper.dart"; | |
| 9 import 'memory_compiler.dart'; | |
| 10 | |
| 11 const String TEST_ONE = r""" | |
| 12 library main; | |
| 13 | |
| 14 int a = 2; | |
| 15 | |
| 16 class c { | |
| 17 final int m; | |
| 18 c(this.m); | |
| 19 } | |
| 20 | |
| 21 void f() { | |
| 22 () {} (); // TODO (sigurdm) empty closure, hack to avoid inlining | |
| 23 a = 2; | |
| 24 } | |
| 25 | |
| 26 main() { | |
| 27 f(); | |
| 28 new c(2); | |
| 29 } | |
| 30 """; | |
| 31 | |
| 32 main() { | |
| 33 MemoryCompiler compiler = compilerFor({'main.dart': TEST_ONE}); | |
| 34 asyncTest(() => compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) { | |
| 35 Map info = compiler.backend.collectDumpInfo(); | |
| 36 print(info); | |
| 37 var mainlib = info["libraries"][0]; | |
| 38 Expect.stringEquals(mainlib["name"], "main"); | |
| 39 var contents = mainlib["contents"]; | |
| 40 Expect.stringEquals(mainlib["name"], "main"); | |
| 41 Expect.stringEquals(contents[0]["name"], "a"); | |
| 42 Expect.stringEquals(contents[1]["name"], "c"); | |
| 43 Expect.stringEquals(contents[2]["name"], "f"); | |
| 44 Expect.stringEquals(contents[3]["name"], "main"); | |
| 45 Expect.stringEquals(mainlib["kind"], "library"); | |
| 46 Expect.stringEquals(contents[0]["kind"], "field"); | |
| 47 Expect.stringEquals(contents[1]["kind"], "class"); | |
| 48 Expect.stringEquals(contents[2]["kind"], "function"); | |
| 49 Expect.stringEquals(contents[3]["kind"], "function"); | |
| 50 })); | |
| 51 ; | |
|
ahe
2013/11/27 19:28:53
?
sigurdm
2013/11/29 10:39:37
Done.
| |
| 52 } | |
| OLD | NEW |