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

Unified Diff: lib/compiler/implementation/dart_backend/emitter.dart

Issue 10695171: dart2dart fix "get" appearing before type in typed getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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
« no previous file with comments | « no previous file | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/dart_backend/emitter.dart
diff --git a/lib/compiler/implementation/dart_backend/emitter.dart b/lib/compiler/implementation/dart_backend/emitter.dart
index caa521969b62eb0561d2a99ec78cbfaa3a613fae..fb929f8e6bb50f4efb6a0dc1a283b25316496707 100644
--- a/lib/compiler/implementation/dart_backend/emitter.dart
+++ b/lib/compiler/implementation/dart_backend/emitter.dart
@@ -7,10 +7,10 @@
*/
class Emitter {
- final DiagnosticListener listener;
+ final Compiler compiler;
final StringBuffer sb;
- Emitter(this.listener) : sb = new StringBuffer();
+ Emitter(this.compiler) : sb = new StringBuffer();
/**
* Outputs given class element with selected inner elements.
@@ -47,15 +47,24 @@ class Emitter {
}
// TODO(smok): Maybe not rely on node unparsing,
// but unparse initializer manually.
- sb.add(element.parseNode(listener).unparse());
+ sb.add(element.parseNode(compiler).unparse());
sb.add(';');
- } else {
- if (element.isSetter()) {
- sb.add('set ');
- } else if (element.isGetter()) {
- sb.add('get ');
+ } else if (element.isSetter() || element.isGetter()) {
Anton Muhin 2012/07/12 08:58:02 can you fix it in the unparser?
Roman 2012/07/12 09:25:40 Done!
+ if (element.type !== null) {
+ assert(element.type is FunctionType);
+ if (element.type.returnType !== compiler.types.dynamicType) {
+ element.type.returnType.name.printOn(sb);
+ sb.add(' ');
+ }
}
- sb.add(element.parseNode(listener).unparse());
+ sb.add(element.isGetter() ? 'get' : 'set');
+ sb.add(' ');
+ element.name.printOn(sb);
+ FunctionExpression node = element.parseNode(compiler);
+ sb.add(node.parameters.unparse());
+ sb.add(node.body.unparse());
+ } else {
+ sb.add(element.parseNode(compiler).unparse());
}
}
« no previous file with comments | « no previous file | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698