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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart

Issue 23479025: Implement reflection on function type aliases (typedef). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: ParameterMirror.isStatic Created 7 years, 3 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: dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
index 6e3ddfb0c523582ba8dcd320d8fdeea0b914d825..3118874217d4d8cebfdf1478105c9cb3c626cab5 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
@@ -3692,7 +3692,19 @@ class CodeEmitterTask extends CompilerTask {
}
void emitMetadata(CodeBuffer buffer) {
- buffer.write('init.metadata$_=$_[');
+ var literals = backend.typedefTypeLiterals.toList();
+ Elements.sortedByPosition(literals);
+ var properties = [];
+ for (TypedefElement literal in literals) {
+ var key = namer.getName(literal);
+ var value = js.toExpression(reifyType(literal.rawType));
+ properties.add(new jsAst.Property(js.string(key), value));
+ }
+ var map = new jsAst.ObjectInitializer(properties);
+ buffer.write(
+ jsAst.prettyPrint(
+ js('init.functionAliases = #', map).toStatement(), compiler));
+ buffer.write('${N}init.metadata$_=$_[');
for (var metadata in globalMetadata) {
if (metadata is String) {
if (metadata != 'null') {
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart ('k') | dart/sdk/lib/_internal/lib/js_mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698