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

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

Issue 18463003: Implement the invoke methods (invoke, getField, setField, newInstance, apply) as internal natives. (Closed) Base URL: http://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/vm/dart_entry.cc ('K') | « runtime/vm/dart_entry.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/mirrors/constructors_test.dart
===================================================================
--- tests/lib/mirrors/constructors_test.dart (revision 24825)
+++ tests/lib/mirrors/constructors_test.dart (working copy)
@@ -26,6 +26,14 @@
Biz.named();
}
+class Buz {
+ var x;
+ Buz.generative(this.x);
+ Buz.redirecting(y) : this.generative(y*2);
+ factory Buz.faktory(y) => "Buz $y";
+ factory Buz.redirectingFactory(y) = Buz.faktory;
+}
+
main() {
MirrorSystem mirrors = currentMirrorSystem();
ClassMirror fooMirror = reflectClass(Foo);
@@ -62,4 +70,18 @@
expect('[s(), s(named)]',
bizConstructors.values.map((m) => m.constructorName).toList()
..sort(compareSymbols));
+
+ ClassMirror buzMirror = reflectClass(Buz);
+ Expect.equals(7,
+ buzMirror.newInstance(const Symbol('generative'),
+ [7]).reflectee.x);
+ Expect.equals(14,
+ buzMirror.newInstance(const Symbol('redirecting'),
+ [7]).reflectee.x);
+ Expect.equals('Buz 7',
+ buzMirror.newInstance(const Symbol('faktory'),
+ [7]).reflectee);
+ Expect.equals('Buz 7',
+ buzMirror.newInstance(const Symbol('redirectingFactory'),
+ [7]).reflectee);
}
« runtime/vm/dart_entry.cc ('K') | « runtime/vm/dart_entry.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698