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

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

Issue 717103004: Revert "Emit warning on import of dart:mirrors." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
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 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 'package:compiler/src/dart2jslib.dart' show 8 import 'package:compiler/src/dart2jslib.dart' show
9 DualKind, 9 DualKind,
10 MessageKind; 10 MessageKind;
11 11
12 import 'message_kind_helper.dart'; 12 import 'message_kind_helper.dart';
13 13
14 import 'dart:mirrors'; 14 import 'dart:mirrors';
15 15
16 main(List<String> arguments) { 16 main(List<String> arguments) {
17 ClassMirror cls = reflectClass(MessageKind); 17 ClassMirror cls = reflectClass(MessageKind);
18 Map<String, MessageKind> kinds = <String, MessageKind>{}; 18 Map<String, MessageKind> kinds = <String, MessageKind>{};
19 cls.declarations.forEach((Symbol name, DeclarationMirror declaration) { 19 cls.declarations.forEach((Symbol name, DeclarationMirror declaration) {
20 if (declaration is! VariableMirror) return; 20 if (declaration is! VariableMirror) return;
21 VariableMirror variable = declaration; 21 VariableMirror variable = declaration;
22 if (variable.isStatic) { 22 if (variable.isStatic) {
23 var value = cls.getField(name).reflectee; 23 var value = cls.getField(name).reflectee;
24 String variableName = MirrorSystem.getName(name);
25 if (variableName == 'IMPORT_EXPERIMENTAL_MIRRORS_PADDING') {
26 return;
27 }
28 if (value is MessageKind) { 24 if (value is MessageKind) {
29 kinds[variableName] = value; 25 kinds[MirrorSystem.getName(name)] = value;
30 } else { 26 } else {
31 Expect.fail("Weird static field: '${variableName}'."); 27 Expect.fail("Weird static field: '${MirrorSystem.getName(name)}'.");
32 } 28 }
33 } 29 }
34 }); 30 });
35 List<String> names = kinds.keys.toList()..sort(); 31 List<String> names = kinds.keys.toList()..sort();
36 List<String> examples = <String>[]; 32 List<String> examples = <String>[];
37 for (String name in names) { 33 for (String name in names) {
38 if (!arguments.isEmpty && !arguments.contains(name)) continue; 34 if (!arguments.isEmpty && !arguments.contains(name)) continue;
39 MessageKind kind = kinds[name]; 35 MessageKind kind = kinds[name];
40 if (name == 'GENERIC' // Shouldn't be used. 36 if (name == 'GENERIC' // Shouldn't be used.
41 // We can't provoke a crash. 37 // We can't provoke a crash.
(...skipping 11 matching lines...) Expand all
53 asyncTest(() => Future.forEach(examples, (String name) { 49 asyncTest(() => Future.forEach(examples, (String name) {
54 print("Checking '$name'."); 50 print("Checking '$name'.");
55 Stopwatch sw = new Stopwatch()..start(); 51 Stopwatch sw = new Stopwatch()..start();
56 return check(kinds[name], cachedCompiler).then((var compiler) { 52 return check(kinds[name], cachedCompiler).then((var compiler) {
57 cachedCompiler = compiler; 53 cachedCompiler = compiler;
58 sw.stop(); 54 sw.stop();
59 print("Checked '$name' in ${sw.elapsedMilliseconds}ms."); 55 print("Checked '$name' in ${sw.elapsedMilliseconds}ms.");
60 }); 56 });
61 })); 57 }));
62 } 58 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/message_kind_helper.dart ('k') | tests/compiler/dart2js/mirrors_used_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698