Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: tests/compiler/dart2js/mirror_helper_unique_minification_test.dart

Issue 22791002: Add renames in output when using the mirror helper library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added an assert. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/compiler/dart2js/mirror_helper_test.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/mirror_helper_unique_minification_test.dart
diff --git a/tests/compiler/dart2js/mirror_helper_unique_minification_test.dart b/tests/compiler/dart2js/mirror_helper_unique_minification_test.dart
index 35885cde245992bd9479c9734e44c7497ff9eda0..c1206fcbe3f0091e13cd8badfb88b135a5532a56 100644
--- a/tests/compiler/dart2js/mirror_helper_unique_minification_test.dart
+++ b/tests/compiler/dart2js/mirror_helper_unique_minification_test.dart
@@ -10,6 +10,10 @@ import
'../../../sdk/lib/_internal/compiler/implementation/dart_backend/dart_backend.dart'
show
DartBackend;
+import
+ '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'
+show
+ Node;
main() {
testUniqueMinification();
@@ -31,10 +35,25 @@ Compiler runCompiler({useMirrorHelperLibrary: false, minify: false}) {
void testUniqueMinification() {
Compiler compiler = runCompiler(useMirrorHelperLibrary: true, minify: true);
DartBackend backend = compiler.backend;
+ MirrorRenamer mirrorRenamer = backend.mirrorRenamer;
Map<Node, String> renames = backend.renames;
+ Map<String, SourceString> symbols = mirrorRenamer.symbols;
- //'Foo' appears twice, so toSet() reduces the length by 1.
- Expect.equals(renames.values.toSet().length, renames.values.length - 1);
+ // Check that no two different source code names get the same mangled name,
+ // with the exception of MirrorSystem.getName that gets renamed to the same
+ // mangled name as the getNameHelper from _mirror_helper.dart.
+ for (Node node in renames.keys) {
+ Identifier identifier = node.asIdentifier();
+ if (identifier != null) {
+ SourceString source = identifier.source;
+ if (mirrorRenamer.mirrorSystemGetNameNodes.first.selector == node)
+ continue;
+ if (symbols.containsKey(renames[node])) {
+ print(node);
+ Expect.equals(source, symbols[renames[node]]);
+ }
+ }
+ }
}
void testNoUniqueMinification() {
@@ -42,7 +61,7 @@ void testNoUniqueMinification() {
DartBackend backend = compiler.backend;
Map<Node, String> renames = backend.renames;
- //'Foo' appears twice and now 'invocation' and 'hest' can get the same name.
+ // 'Foo' appears twice and 'invocation' and 'hest' get the same mangled name.
Expect.equals(renames.values.toSet().length, renames.values.length - 2);
}
@@ -52,7 +71,7 @@ import 'dart:mirrors';
class Foo {
noSuchMethod(invocation) {
- MirrorSystem.getName(const Symbol('hest'));
+ MirrorSystem.getName(null);
}
}
« no previous file with comments | « tests/compiler/dart2js/mirror_helper_test.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698