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

Unified Diff: tests/lib/mirrors/class_mirror_type_variables_test.dart

Issue 20216002: Make ClassMirror.typeVariables lazy and convert dependencies to native code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« runtime/lib/mirrors.cc ('K') | « tests/lib/lib.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/mirrors/class_mirror_type_variables_test.dart
diff --git a/tests/lib/mirrors/class_mirror_type_variables_test.dart b/tests/lib/mirrors/class_mirror_type_variables_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..2b02bad6104afc8ff336da95433930c3fd63ff55
--- /dev/null
+++ b/tests/lib/mirrors/class_mirror_type_variables_test.dart
@@ -0,0 +1,33 @@
+// 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 "dart:mirrors";
+
+import "package:expect/expect.dart";
+
+class C<R,S,T> {
+ R foo(R r) => r;
+ S bar(S s) => s;
+ T baz(T t) => t;
+}
+
+class NoTypeParams {}
+
+main() {
+ ClassMirror cm;
+ cm = reflectClass(C);
+ Expect.equals(3, cm.typeVariables.length);
+ Expect.equals(true, cm.typeVariables.containsKey(const Symbol("R")));
+ Expect.equals(true, cm.typeVariables.containsKey(const Symbol("S")));
+ Expect.equals(true, cm.typeVariables.containsKey(const Symbol("T")));
+ var values = cm.typeVariables.values;
+ values.forEach((e) {
+ Expect.equals(true, e is TypeVariableMirror);
+ });
+ Expect.equals(const Symbol("R"), values.elementAt(0).simpleName);
+ Expect.equals(const Symbol("S"), values.elementAt(1).simpleName);
+ Expect.equals(const Symbol("T"), values.elementAt(2).simpleName);
+ cm = reflectClass(NoTypeParams);
+ Expect.equals(cm.typeVariables.length, 0);
+}
« runtime/lib/mirrors.cc ('K') | « tests/lib/lib.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698