OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
8 import 'memory_compiler.dart' show compilerFor; | 8 import 'memory_compiler.dart' show compilerFor; |
9 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart' show | 9 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart' show |
10 Compiler; | 10 Compiler; |
(...skipping 22 matching lines...) Expand all Loading... |
33 return | 33 return |
34 compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) => compiler); | 34 compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) => compiler); |
35 } | 35 } |
36 | 36 |
37 void testUniqueMinification() { | 37 void testUniqueMinification() { |
38 asyncTest(() => runCompiler(useMirrorHelperLibrary: true, minify: true). | 38 asyncTest(() => runCompiler(useMirrorHelperLibrary: true, minify: true). |
39 then((Compiler compiler) { | 39 then((Compiler compiler) { |
40 DartBackend backend = compiler.backend; | 40 DartBackend backend = compiler.backend; |
41 MirrorRenamer mirrorRenamer = backend.mirrorRenamer; | 41 MirrorRenamer mirrorRenamer = backend.mirrorRenamer; |
42 Map<Node, String> renames = backend.renames; | 42 Map<Node, String> renames = backend.renames; |
43 Map<String, SourceString> symbols = mirrorRenamer.symbols; | 43 Map<String, String> symbols = mirrorRenamer.symbols; |
44 | 44 |
45 // Check that no two different source code names get the same mangled name, | 45 // Check that no two different source code names get the same mangled name, |
46 // with the exception of MirrorSystem.getName that gets renamed to the same | 46 // with the exception of MirrorSystem.getName that gets renamed to the same |
47 // mangled name as the getNameHelper from _mirror_helper.dart. | 47 // mangled name as the getNameHelper from _mirror_helper.dart. |
48 for (Node node in renames.keys) { | 48 for (Node node in renames.keys) { |
49 Identifier identifier = node.asIdentifier(); | 49 Identifier identifier = node.asIdentifier(); |
50 if (identifier != null) { | 50 if (identifier != null) { |
51 SourceString source = identifier.source; | 51 String source = identifier.source; |
52 if (mirrorRenamer.mirrorSystemGetNameNodes.first.selector == node) | 52 if (mirrorRenamer.mirrorSystemGetNameNodes.first.selector == node) |
53 continue; | 53 continue; |
54 if (symbols.containsKey(renames[node])) { | 54 if (symbols.containsKey(renames[node])) { |
55 print(node); | 55 print(node); |
56 Expect.equals(source, symbols[renames[node]]); | 56 Expect.equals(source, symbols[renames[node]]); |
57 } | 57 } |
58 } | 58 } |
59 } | 59 } |
60 })); | 60 })); |
61 } | 61 } |
(...skipping 18 matching lines...) Expand all Loading... |
80 noSuchMethod(invocation) { | 80 noSuchMethod(invocation) { |
81 MirrorSystem.getName(null); | 81 MirrorSystem.getName(null); |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 main() { | 85 main() { |
86 new Foo().fisk(); | 86 new Foo().fisk(); |
87 var hest; | 87 var hest; |
88 } | 88 } |
89 """}; | 89 """}; |
OLD | NEW |