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

Side by Side Diff: tests/compiler/dart2js/mirrors_used_test.dart

Issue 236313012: Don't hide interceptors in mirrors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/lib/js_rti.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /// Test that the @MirrorsUsed annotation suppress hints and that only 5 /// Test that the @MirrorsUsed annotation suppress hints and that only
6 /// requested elements are retained for reflection. 6 /// requested elements are retained for reflection.
7 library dart2js.test.mirrors_used_test; 7 library dart2js.test.mirrors_used_test;
8 8
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 import "package:async_helper/async_helper.dart"; 10 import "package:async_helper/async_helper.dart";
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // The following names should be retained: 67 // The following names should be retained:
68 List expectedNames = [ 68 List expectedNames = [
69 'Foo', // The name of class Foo. 69 'Foo', // The name of class Foo.
70 r'Foo$', // The name of class Foo's constructor. 70 r'Foo$', // The name of class Foo's constructor.
71 r'get$field']; // The (getter) name of Foo.field. 71 r'get$field']; // The (getter) name of Foo.field.
72 // TODO(ahe): Check for the following names, currently they are not being 72 // TODO(ahe): Check for the following names, currently they are not being
73 // recorded correctly, but are being emitted. 73 // recorded correctly, but are being emitted.
74 [ 74 [
75 'Foo_staticMethod', // The name of Foo.staticMethod. 75 'Foo_staticMethod', // The name of Foo.staticMethod.
76 r'instanceMethod$0']; // The name of Foo.instanceMethod. 76 r'instanceMethod$0']; // The name of Foo.instanceMethod.
77
78 // We always include the names of some native classes.
79 List<Element> nativeClasses = [
80 compiler.intClass, compiler.doubleClass, compiler.numClass,
81 compiler.stringClass, compiler.boolClass, compiler.nullClass,
82 compiler.listClass
83 ];
84
85 Iterable<String> nativeNames =
86 nativeClasses.map(compiler.backend.namer.getNameOfClass);
87 expectedNames.addAll(nativeNames);
88
77 Set recordedNames = new Set() 89 Set recordedNames = new Set()
78 ..addAll(compiler.backend.emitter.recordedMangledNames) 90 ..addAll(compiler.backend.emitter.recordedMangledNames)
79 ..addAll(compiler.backend.emitter.mangledFieldNames.keys) 91 ..addAll(compiler.backend.emitter.mangledFieldNames.keys)
80 ..addAll(compiler.backend.emitter.mangledGlobalFieldNames.keys); 92 ..addAll(compiler.backend.emitter.mangledGlobalFieldNames.keys);
81 Expect.setEquals(new Set.from(expectedNames), recordedNames); 93 Expect.setEquals(new Set.from(expectedNames), recordedNames);
82 94
83 for (var library in compiler.libraries.values) { 95 for (var library in compiler.libraries.values) {
84 library.forEachLocalMember((member) { 96 library.forEachLocalMember((member) {
85 if (library == compiler.mainApp && member.name == 'Foo') { 97 if (library == compiler.mainApp && member.name == 'Foo') {
86 Expect.isTrue( 98 Expect.isTrue(
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 library lib; 162 library lib;
151 163
152 import 'dart:mirrors'; 164 import 'dart:mirrors';
153 165
154 useReflect(type) { 166 useReflect(type) {
155 print(new Symbol('Foo')); 167 print(new Symbol('Foo'));
156 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); 168 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName));
157 } 169 }
158 """, 170 """,
159 }; 171 };
OLDNEW
« no previous file with comments | « sdk/lib/_internal/lib/js_rti.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698