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

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

Issue 1235563003: Add interfaces for a new compiler API. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Rebased Created 5 years, 5 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
« no previous file with comments | « tests/compiler/dart2js/mirrors_test.dart ('k') | tests/compiler/dart2js/missing_file_test.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 11 matching lines...) Expand all
22 import 'package:compiler/src/elements/elements.dart' show 22 import 'package:compiler/src/elements/elements.dart' show
23 Element, 23 Element,
24 Elements; 24 Elements;
25 25
26 import 'package:compiler/src/js_backend/js_backend.dart' show 26 import 'package:compiler/src/js_backend/js_backend.dart' show
27 JavaScriptBackend; 27 JavaScriptBackend;
28 28
29 import 'package:compiler/src/js_emitter/full_emitter/emitter.dart' 29 import 'package:compiler/src/js_emitter/full_emitter/emitter.dart'
30 as full show Emitter; 30 as full show Emitter;
31 31
32 import 'package:compiler/src/old_to_new_api.dart' show
33 LegacyCompilerDiagnostics;
34
32 void expectOnlyVerboseInfo(Uri uri, int begin, int end, String message, kind) { 35 void expectOnlyVerboseInfo(Uri uri, int begin, int end, String message, kind) {
33 if (kind.name == 'verbose info') { 36 if (kind.name == 'verbose info') {
34 print(message); 37 print(message);
35 return; 38 return;
36 } 39 }
37 if (message.contains('methods retained for use by dart:mirrors out of')) { 40 if (message.contains('methods retained for use by dart:mirrors out of')) {
38 print(message); 41 print(message);
39 return; 42 return;
40 } 43 }
41 if (kind.name == 'info') return; 44 if (kind.name == 'info') return;
42 45
43 // TODO(aprelev@gmail.com): Remove once dartbug.com/13907 is fixed. 46 // TODO(aprelev@gmail.com): Remove once dartbug.com/13907 is fixed.
44 if (message.contains("Warning: 'typedef' not allowed here")) return; 47 if (message.contains("Warning: 'typedef' not allowed here")) return;
45 48
46 throw '$uri:$begin:$end: $kind: $message'; 49 throw '$uri:$begin:$end: $kind: $message';
47 } 50 }
48 51
49 void main() { 52 void main() {
50 Compiler compiler = compilerFor( 53 Compiler compiler = compilerFor(
51 MEMORY_SOURCE_FILES, diagnosticHandler: expectOnlyVerboseInfo, 54 MEMORY_SOURCE_FILES,
55 diagnosticHandler: new LegacyCompilerDiagnostics(expectOnlyVerboseInfo),
52 options: ['--enable-experimental-mirrors']); 56 options: ['--enable-experimental-mirrors']);
53 asyncTest(() => compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) { 57 asyncTest(() => compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) {
54 print(''); 58 print('');
55 List generatedCode = 59 List generatedCode =
56 Elements.sortedByPosition(compiler.enqueuer.codegen.generatedCode.keys); 60 Elements.sortedByPosition(compiler.enqueuer.codegen.generatedCode.keys);
57 for (var element in generatedCode) { 61 for (var element in generatedCode) {
58 print(element); 62 print(element);
59 } 63 }
60 print(''); 64 print('');
61 65
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 library lib; 176 library lib;
173 177
174 import 'dart:mirrors'; 178 import 'dart:mirrors';
175 179
176 useReflect(type) { 180 useReflect(type) {
177 print(new Symbol('Foo')); 181 print(new Symbol('Foo'));
178 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); 182 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName));
179 } 183 }
180 """, 184 """,
181 }; 185 };
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/mirrors_test.dart ('k') | tests/compiler/dart2js/missing_file_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698