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

Side by Side Diff: test_reflectable/test/reflectors_test.dart

Issue 1391543003: Creates `reflectors`, as a meta-meta feature that enables dynamic selection of a "mirror system". (Closed) Base URL: https://github.com/dart-lang/reflectable.git@master
Patch Set: Added lots of LibraryMirror support in order to make reflectors work in transformed code Created 5 years, 2 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
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart Team. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in
3 // the LICENSE file.
4
5 library test_reflectable.test.reflectors_test;
6
7 @GlobalQuantifyCapability(r".(A|B)$", const Reflector3())
8 @GlobalQuantifyMetaCapability(P, const Reflector4())
9 import "package:reflectable/reflectable.dart";
10 import "package:unittest/unittest.dart";
11
12 class Reflector extends Reflectable {
13 const Reflector()
14 : super(invokingCapability, declarationsCapability, libraryCapability);
15 }
16
17 class Reflector2 extends Reflectable {
18 const Reflector2()
19 : super(invokingCapability, metadataCapability, libraryCapability);
20 }
21
22 class Reflector3 extends Reflectable {
23 const Reflector3() : super(invokingCapability);
24 }
25
26 class Reflector4 extends Reflectable {
27 const Reflector4() : super(declarationsCapability);
28 }
29
30 class ReflectorUpwardsClosed extends Reflectable {
31 const ReflectorUpwardsClosed()
32 : super(superclassQuantifyCapability, invokingCapability,
33 declarationsCapability, typeRelationsCapability);
34 }
35
36 class ReflectorUpwardsClosedToA extends Reflectable {
37 const ReflectorUpwardsClosedToA()
38 : super(const SuperclassQuantifyCapability(A), invokingCapability,
39 declarationsCapability);
40 }
41
42 class ReflectorUpwardsClosedUntilA extends Reflectable {
43 const ReflectorUpwardsClosedUntilA()
44 : super(const SuperclassQuantifyCapability(A, excludeUpperBound: true),
45 invokingCapability, declarationsCapability);
46 }
47
48 @Reflector()
49 @Reflector2()
50 @P()
51 class M1 {
52 foo() {}
53 var field;
54 static staticFoo(x) {}
55 }
56
57 class P {
58 const P();
59 }
60
61 @Reflector()
62 @Reflector2()
63 class M2 {}
64
65 @Reflector()
66 @Reflector2()
67 class M3 {}
68
69 @Reflector()
70 class A {
71 foo() {}
72 var field;
73 static staticFoo(x) {}
74 static staticBar() {}
75 }
76
77 @Reflector()
78 @Reflector2()
79 class B extends A with M1 {}
80
81 @Reflector()
82 @Reflector2()
83 @ReflectorUpwardsClosed()
84 @ReflectorUpwardsClosedUntilA()
85 class C extends B with M2, M3 {}
86
87 @Reflector()
88 @Reflector2()
89 @ReflectorUpwardsClosed()
90 @ReflectorUpwardsClosedToA()
91 class D = A with M1;
92
93 main() {
94 test("Mixin, superclasses not included", () {
95 expect(
96 Reflectable.reflectors,
97 [
98 const Reflector(),
99 const Reflector2(),
100 const Reflector3(),
101 const Reflector4(),
102 const ReflectorUpwardsClosed(),
103 const ReflectorUpwardsClosedToA(),
104 const ReflectorUpwardsClosedUntilA()
105 ].toSet());
106 });
107 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698