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 | |
|
kasperl
2013/11/29 12:03:13
See if you can use @NoInline() annotation and get
sigurdm
2013/12/02 14:09:50
This seems to be a bit harder - the annotation is
| |
| 23 a = 2; | |
| 24 } | |
| 25 | |
| 26 main() { | |
| 27 f(); | |
| 28 new c(2); | |
| 29 } | |
| 30 """; | |
| 31 | |
| 32 main() { | |
| 33 var compiler = compilerFor({'main.dart': TEST_ONE}); | |
| 34 asyncTest(() => compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) { | |
| 35 var info = compiler.dumpInfoTask.collectDumpInfo(); | |
| 36 var mainlib = info.libraries[0]; | |
| 37 Expect.stringEquals(mainlib.name, "main"); | |
|
kasperl
2013/11/29 12:03:13
Expect.stringEquals expects the expected result as
sigurdm
2013/12/02 14:09:50
Done.
| |
| 38 var contents = mainlib.contents; | |
| 39 Expect.stringEquals(mainlib.name, "main"); | |
| 40 Expect.stringEquals(contents[0].name, "a"); | |
| 41 Expect.stringEquals(contents[1].name, "c"); | |
| 42 Expect.stringEquals(contents[2].name, "f"); | |
| 43 Expect.stringEquals(contents[3].name, "main"); | |
| 44 Expect.stringEquals(mainlib.kind, "library"); | |
| 45 Expect.stringEquals(contents[0].kind, "field"); | |
| 46 Expect.stringEquals(contents[1].kind, "class"); | |
| 47 Expect.stringEquals(contents[2].kind, "function"); | |
| 48 Expect.stringEquals(contents[3].kind, "function"); | |
| 49 })); | |
| 50 } | |
| OLD | NEW |