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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_emitter/container_builder.dart

Issue 160343002: Implement reflection on annotations of parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment. Created 6 years, 10 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
Index: sdk/lib/_internal/compiler/implementation/js_emitter/container_builder.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_emitter/container_builder.dart b/sdk/lib/_internal/compiler/implementation/js_emitter/container_builder.dart
index ed3e5ae4bd32d50799e9b298d1b6643f89693728..b9bc0bd0b524a2bdef2f3eaef20d0479d6fb2afb 100644
--- a/sdk/lib/_internal/compiler/implementation/js_emitter/container_builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_emitter/container_builder.dart
@@ -486,6 +486,15 @@ class ContainerBuilder extends CodeEmitterHelper {
if (canBeReflected || canBeApplied) {
parameters.orderedForEachParameter((Element parameter) {
expressions.add(task.metadataEmitter.reifyName(parameter.name));
+ List<MetadataAnnotation> annotations = parameter.metadata.toList();
+ Iterable<int> metadataIndices = annotations.map((MetadataAnnotation a) {
+ compiler.constantHandler.addCompileTimeConstantForEmission(a.value);
+ return task.metadataEmitter.reifyMetadata(a);
+ });
+ // TODO(karlklose): store metadata on elements in correct source order.
+ metadataIndices = metadataIndices.toList().reversed.toList();
+ expressions.add(metadataIndices.isNotEmpty ? metadataIndices
+ : js('[]'));
});
}
if (canBeReflected) {

Powered by Google App Engine
This is Rietveld 408576698