-
Notifications
You must be signed in to change notification settings - Fork 1.7k
dart2js should provide reflective access to metadata #10905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
How will this work for compile-time mirrors? Will hasReflectee on the InstanceMirrors return true? If so, what type will it be and will there be a way visit the value? |
This bug is for runtime support, dart2js already supports metadata for source mirrors. Some source-InstanceMirrors have a reflectee, but only simple values such as bool, int, String, etc. For lists and maps, Johnni added some convenience methods for accessing their elements. For more complex constants, you have to look at their fields. Take a look at dart/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart. Feel free to ask additional questions about source mirrors at [email protected]. |
https://codereview.chromium.org/16101007/ implements LibraryMirror.metadata. |
CL 16101007 landed in r23406. |
https://codereview.chromium.org/15821011/ implements ClassMirror.metadata. |
CL 15821011 landed in r23457. |
https://codereview.chromium.org/15861028/ implements MethodMirror.metadata. |
CL 15861028 landed in r23529. |
https://codereview.chromium.org/16156013/ implements metadata on instance fields. |
CL 16156013 landed in r23580. |
Thanks Peter. Just tried a simple case and it worked! import 'dart:mirrors'; const awesome = const Awesome('way cool'); class Awesome { @awesome('it works!') void main() { Do you have an easy list of things you expect to work at this point? |
See this test for what works in both dart2js and the VM: |
Added Library-Mirrors label. |
Marked this as blocking #6490. |
Marked this as blocking #6614. |
dart2js should support this getter on DeclarationMirror:
/**
* A list of the metadata associated with this declaration.
*/
List<InstanceMirror> get metadata;
See issue #6614.
The text was updated successfully, but these errors were encountered: