Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 // File being transformed by the reflectable transformer. | |
| 6 // Creates a `MetaReflector` which may be used to reflect on the set of | |
| 7 // reflectors themselves. | |
| 8 // | |
| 9 // Independence: This is the only library in this program where both the | |
| 10 // reflector classes and the domain classes are seen together. The program | |
| 11 // as a whole illustrates a number of ways in which it is possible to make | |
| 12 // reflection, usage of reflection, and application specific classes (here | |
| 13 // known as 'domain classes') independent of each other, statically and | |
| 14 // dynamically. | |
| 15 | |
| 16 library test_reflectable.test.meta_reflectors_test; | |
| 17 | |
| 18 @GlobalQuantifyCapability(r"\.(M1|M2|M3|A|B|C|D)$", const Reflector()) | |
| 19 @GlobalQuantifyCapability(r"\.(M1|M2|M3|B|C|D)$", const Reflector2()) | |
| 20 @GlobalQuantifyCapability(r"\.(C|D)$", const ReflectorUpwardsClosed()) | |
| 21 @GlobalQuantifyCapability(r"\.(C|D)$", const ReflectorUpwardsClosedToA()) | |
| 22 @GlobalQuantifyCapability(r"\.(C|D)$", const ReflectorUpwardsClosedUntilA()) | |
| 23 import "package:reflectable/reflectable.dart"; | |
| 24 import "meta_reflectors_domain_definer.dart"; | |
| 25 import "meta_reflectors_definer.dart"; | |
| 26 import "meta_reflectors_scoping.dart"; | |
| 27 import "meta_reflectors_user.dart"; | |
| 28 | |
| 29 Map<String, Iterable<Reflectable>> scopeMap = <String, Iterable<Reflectable>>{ | |
|
sigurdm
2015/10/09 07:52:04
While this is a perfectly valid approach, I still
eernst
2015/10/09 10:09:05
Why don't you write that as an extra test case? ;)
sigurdm
2015/10/09 10:47:20
Good idea!
| |
| 30 "polymer": <Reflectable>[const Reflector(), const ReflectorUpwardsClosed()], | |
| 31 "observe": <Reflectable>[const Reflector2(), const ReflectorUpwardsClosed()] | |
| 32 }; | |
| 33 | |
| 34 @ScopeMetaReflector() | |
| 35 Iterable<Reflectable> reflectablesOfScope(String scope) => scopeMap[scope]; | |
| 36 | |
| 37 main() { | |
| 38 doit(); | |
| 39 } | |
| OLD | NEW |