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

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

Issue 2916893002: Handle int constant (Closed)
Patch Set: Updated cf. comments Created 3 years, 6 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
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 10 matching lines...) Expand all
21 21
22 import 'package:compiler/src/js_backend/js_backend.dart' show JavaScriptBackend; 22 import 'package:compiler/src/js_backend/js_backend.dart' show JavaScriptBackend;
23 import 'package:compiler/src/js_backend/mirrors_analysis.dart'; 23 import 'package:compiler/src/js_backend/mirrors_analysis.dart';
24 24
25 import 'package:compiler/src/js_emitter/full_emitter/emitter.dart' as full 25 import 'package:compiler/src/js_emitter/full_emitter/emitter.dart' as full
26 show Emitter; 26 show Emitter;
27 27
28 import 'package:compiler/src/old_to_new_api.dart' 28 import 'package:compiler/src/old_to_new_api.dart'
29 show LegacyCompilerDiagnostics; 29 show LegacyCompilerDiagnostics;
30 30
31 import 'package:compiler/src/universe/world_builder.dart';
32
31 void expectOnlyVerboseInfo(Uri uri, int begin, int end, String message, kind) { 33 void expectOnlyVerboseInfo(Uri uri, int begin, int end, String message, kind) {
32 if (kind.name == 'verbose info') { 34 if (kind.name == 'verbose info') {
33 print(message); 35 print(message);
34 return; 36 return;
35 } 37 }
36 if (message.contains('methods retained for use by dart:mirrors out of')) { 38 if (message.contains('methods retained for use by dart:mirrors out of')) {
37 print(message); 39 print(message);
38 return; 40 return;
39 } 41 }
40 if (kind.name == 'info') return; 42 if (kind.name == 'info') return;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } else { 138 } else {
137 Expect.isFalse( 139 Expect.isFalse(
138 compiler.backend.mirrorsData 140 compiler.backend.mirrorsData
139 .isMemberAccessibleByReflection(member), 141 .isMemberAccessibleByReflection(member),
140 '$member'); 142 '$member');
141 } 143 }
142 }); 144 });
143 } 145 }
144 146
145 int metadataCount = 0; 147 int metadataCount = 0;
146 Set<ConstantValue> compiledConstants = backend.constants.compiledConstants; 148 CodegenWorldBuilderImpl codegenWorldBuilder = compiler.codegenWorldBuilder;
149 Set<ConstantValue> compiledConstants =
150 codegenWorldBuilder.compiledConstants;
147 // Make sure that most of the metadata constants aren't included in the 151 // Make sure that most of the metadata constants aren't included in the
148 // generated code. 152 // generated code.
149 MirrorsResolutionAnalysisImpl mirrorsResolutionAnalysis = 153 MirrorsResolutionAnalysisImpl mirrorsResolutionAnalysis =
150 backend.mirrorsResolutionAnalysis; 154 backend.mirrorsResolutionAnalysis;
151 mirrorsResolutionAnalysis.processMetadata( 155 mirrorsResolutionAnalysis.processMetadata(
152 compiler.enqueuer.resolution.processedEntities, (metadata) { 156 compiler.enqueuer.resolution.processedEntities, (metadata) {
153 ConstantValue constant = 157 ConstantValue constant =
154 backend.constants.getConstantValueForMetadata(metadata); 158 backend.constants.getConstantValueForMetadata(metadata);
155 Expect.isFalse( 159 Expect.isFalse(
156 compiledConstants.contains(constant), constant.toStructuredText()); 160 compiledConstants.contains(constant), constant.toStructuredText());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 library lib; 205 library lib;
202 206
203 import 'dart:mirrors'; 207 import 'dart:mirrors';
204 208
205 useReflect(type) { 209 useReflect(type) {
206 print(new Symbol('Foo')); 210 print(new Symbol('Foo'));
207 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); 211 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName));
208 } 212 }
209 """, 213 """,
210 }; 214 };
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/kernel/compile_from_dill_test.dart ('k') | tests/compiler/dart2js/type_representation_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698