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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: dart/tests/compiler/dart2js/message_kind_test.dart
diff --git a/dart/tests/compiler/dart2js/message_kind_test.dart b/dart/tests/compiler/dart2js/message_kind_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..55f9beda001e3654586d26090ba90c8dff090faf
--- /dev/null
+++ b/dart/tests/compiler/dart2js/message_kind_test.dart
@@ -0,0 +1,52 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' show
+ DualKind,
+ MessageKind;
+
+import 'message_kind_helper.dart';
+
+import 'dart:mirrors';
+
+main() {
+ ClassMirror cls = reflectClass(MessageKind);
+ Map<String, MessageKind> kinds = <String, MessageKind>{};
+ cls.variables.forEach((Symbol name, VariableMirror variable) {
+ if (variable.isStatic) {
+ var value = cls.getField(name).reflectee;
+ if (value is MessageKind) {
+ kinds[MirrorSystem.getName(name)] = value;
+ } else if (value is DualKind) {
+ kinds['${MirrorSystem.getName(name)}.error'] = value.error;
+ kinds['${MirrorSystem.getName(name)}.warning'] = value.warning;
+ } else {
+ Expect.fail("Weird static field: '${MirrorSystem.getName(name)}'.");
+ }
+ }
+ });
+ List<String> names = kinds.keys.toList()..sort();
+ List<String> examples = <String>[];
+ for (String name in names) {
+ MessageKind kind = kinds[name];
+ if (name == 'GENERIC' // Shouldn't be used.
+ // We can't provoke a crash.
+ || name == 'COMPILER_CRASHED'
+ || name == 'PLEASE_REPORT_THE_CRASH'
+ // We cannot provide examples for patch errors.
+ || name.startsWith('PATCH_')) continue;
+ if (kind.examples != null) {
+ examples.add(name);
+ } else {
+ print("No example in '$name'");
+ }
+ };
+ var cachedCompiler;
+ for (String name in examples) {
+ Stopwatch sw = new Stopwatch()..start();
+ cachedCompiler = check(kinds[name], cachedCompiler);
+ sw.stop();
+ print("Checked '$name' in ${sw.elapsedMilliseconds}ms.");
+ }
+}
« 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