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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_emitter/metadata_emitter.dart

Issue 416643002: Support typedefs in function signatures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Recognize typedefs and function mirrors in typeMirrorFromRuntimeTypeRepresentation. Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 class MetadataEmitter extends CodeEmitterHelper { 7 class MetadataEmitter extends CodeEmitterHelper {
8 /// A list of JS expressions that represent metadata, parameter names and 8 /// A list of JS expressions that represent metadata, parameter names and
9 /// type, and return types. 9 /// type, and return types.
10 final List<String> globalMetadata = []; 10 final List<String> globalMetadata = [];
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 if (value == null) { 62 if (value == null) {
63 compiler.internalError(annotation, 'Annotation value is null.'); 63 compiler.internalError(annotation, 'Annotation value is null.');
64 return -1; 64 return -1;
65 } 65 }
66 return addGlobalMetadata( 66 return addGlobalMetadata(
67 jsAst.prettyPrint(task.constantReference(value), compiler).getText()); 67 jsAst.prettyPrint(task.constantReference(value), compiler).getText());
68 } 68 }
69 69
70 int reifyType(DartType type) { 70 int reifyType(DartType type) {
71 jsAst.Expression representation = 71 jsAst.Expression representation =
72 backend.rti.getTypeRepresentation(type, (variable) { 72 backend.rti.getTypeRepresentation(
73 return js.number( 73 type,
74 task.typeVariableHandler.reifyTypeVariable(variable.element)); 74 (variable) {
75 }); 75 return js.number(
76 task.typeVariableHandler.reifyTypeVariable(variable.element));
77 },
78 (TypedefType typedef) => true);
floitsch 2014/08/21 20:33:18 This should check if the typedef is in the mirrors
76 79
77 return addGlobalMetadata( 80 return addGlobalMetadata(
78 jsAst.prettyPrint(representation, compiler).getText()); 81 jsAst.prettyPrint(representation, compiler).getText());
79 } 82 }
80 83
81 int reifyName(String name) { 84 int reifyName(String name) {
82 return addGlobalMetadata('"$name"'); 85 return addGlobalMetadata('"$name"');
83 } 86 }
84 87
85 int addGlobalMetadata(String string) { 88 int addGlobalMetadata(String string) {
(...skipping 26 matching lines...) Expand all
112 // TODO(ahe): Why is metadata sometimes null? 115 // TODO(ahe): Why is metadata sometimes null?
113 if (link != null) { 116 if (link != null) {
114 for (; !link.isEmpty; link = link.tail) { 117 for (; !link.isEmpty; link = link.tail) {
115 metadata.add(reifyMetadata(link.head)); 118 metadata.add(reifyMetadata(link.head));
116 } 119 }
117 } 120 }
118 return metadata; 121 return metadata;
119 }); 122 });
120 } 123 }
121 } 124 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/js_emitter/js_emitter.dart ('k') | sdk/lib/_internal/lib/js_mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698