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

Unified Diff: compiler/java/com/google/dart/compiler/ast/DartToSourceVisitor.java

Issue 10832274: Initial parser changes for the new directive syntax (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: compiler/java/com/google/dart/compiler/ast/DartToSourceVisitor.java
===================================================================
--- compiler/java/com/google/dart/compiler/ast/DartToSourceVisitor.java (revision 10597)
+++ compiler/java/com/google/dart/compiler/ast/DartToSourceVisitor.java (working copy)
@@ -60,23 +60,48 @@
@Override
public Void visitLibraryDirective(DartLibraryDirective node) {
- p("#library(");
- accept(node.getName());
- p(");");
- nl();
+ if (node.isObsoleteFormat()) {
+ p("#library(");
+ accept(node.getName());
+ p(");");
+ nl();
+ } else {
+ p("library ");
+ accept(node.getName());
+ p(";");
+ nl();
+ }
return null;
}
+ @SuppressWarnings("deprecation")
@Override
public Void visitImportDirective(DartImportDirective node) {
- p("#import(");
- accept(node.getLibraryUri());
- if (node.getPrefix() != null) {
- p(", prefix : ");
- accept(node.getPrefix());
+ if (node.isObsoleteFormat()) {
+ p("#import(");
+ accept(node.getLibraryUri());
+ if (node.getOldPrefix() != null) {
+ p(", prefix : ");
+ accept(node.getOldPrefix());
+ }
+ p(");");
+ nl();
+ } else {
+ p("import ");
+ accept(node.getLibraryUri());
+ if (node.getPrefix() != null) {
+ p(" as ");
+ accept(node.getPrefix());
+ }
+ for (ImportCombinator combinator : node.getCombinators()) {
+ accept(combinator);
+ }
+ if (node.isExported()) {
+ p(" & export");
+ }
+ p(";");
+ nl();
}
- p(");");
- nl();
return null;
}

Powered by Google App Engine
This is Rietveld 408576698