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

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

Issue 21242002: Retain elements a finer granularity than library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' show
6 DualKind,
7 MessageKind;
8
9 import 'message_kind_helper.dart';
10
11 import 'dart:mirrors';
12
13 main() {
14 ClassMirror cls = reflectClass(MessageKind);
15 Map<String, MessageKind> kinds = <String, MessageKind>{};
16 cls.variables.forEach((Symbol name, VariableMirror variable) {
17 if (variable.isStatic) {
18 var value = cls.getField(name).reflectee;
19 if (value is MessageKind) {
20 kinds[MirrorSystem.getName(name)] = value;
21 } else if (value is DualKind) {
22 kinds['${MirrorSystem.getName(name)}.error'] = value.error;
23 kinds['${MirrorSystem.getName(name)}.warning'] = value.warning;
24 } else {
25 Expect.fail("Weird static field: '${MirrorSystem.getName(name)}'.");
26 }
27 }
28 });
29 List<String> names = kinds.keys.toList()..sort();
30 List<String> examples = <String>[];
31 for (String name in names) {
32 MessageKind kind = kinds[name];
33 if (name == 'GENERIC' // Shouldn't be used.
34 // We can't provoke a crash.
35 || name == 'COMPILER_CRASHED'
36 || name == 'PLEASE_REPORT_THE_CRASH'
37 // We cannot provide examples for patch errors.
38 || name.startsWith('PATCH_')) continue;
39 if (kind.examples != null) {
40 examples.add(name);
41 } else {
42 print("No example in '$name'");
43 }
44 };
45 var cachedCompiler;
46 for (String name in examples) {
47 Stopwatch sw = new Stopwatch()..start();
48 cachedCompiler = check(kinds[name], cachedCompiler);
49 sw.stop();
50 print("Checked '$name' in ${sw.elapsedMilliseconds}ms.");
51 }
52 }
OLDNEW
« no previous file with comments | « dart/tests/compiler/dart2js/message_kind_helper.dart ('k') | dart/tests/compiler/dart2js/mirrors_used_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698