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

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

Issue 10702114: dart2dart: fix top level field declarations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add todo 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/backend.dart
diff --git a/lib/compiler/implementation/dart_backend/backend.dart b/lib/compiler/implementation/dart_backend/backend.dart
index 9a89b764845616d52ad92ffe35386fd396d7b40e..b03c108c4204ee3cf76c583321093b9c8c1ec910 100644
--- a/lib/compiler/implementation/dart_backend/backend.dart
+++ b/lib/compiler/implementation/dart_backend/backend.dart
@@ -48,7 +48,26 @@ class DartBackend extends Backend {
if (!element.isTopLevel()) {
bailout('Cannot process non top-level $element');
}
- sb.add(element.parseNode(compiler).unparse());
+
+ if (element.isField()) {
+ // Add modifiers first.
+ sb.add(element.modifiers.toString());
+ sb.add(' ');
+ // Figure out type.
+ if (element is VariableElement) {
+ VariableListElement variables = element.variables;
+ if (variables.type !== null) {
+ sb.add(variables.type);
+ sb.add(' ');
+ }
+ }
+ // TODO(smok): Maybe not rely on node unparsing,
+ // but unparse initializer manually.
+ sb.add(element.parseNode(compiler).unparse());
+ sb.add(';');
+ } else {
+ sb.add(element.parseNode(compiler).unparse());
+ }
});
compiler.assembledCode = sb.toString();
} catch (BailoutException e) {
« 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