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

Unified Diff: compiler/java/com/google/dart/compiler/ast/DartImportDirective.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/DartImportDirective.java
===================================================================
--- compiler/java/com/google/dart/compiler/ast/DartImportDirective.java (revision 10597)
+++ compiler/java/com/google/dart/compiler/ast/DartImportDirective.java (working copy)
@@ -10,43 +10,67 @@
* Implements the #import directive.
*/
public class DartImportDirective extends DartDirective {
+ private boolean obsoleteFormat;
+
private DartStringLiteral libraryUri;
- private DartBooleanLiteral exported;
+ private DartIdentifier prefix;
private NodeList<ImportCombinator> combinators = new NodeList<ImportCombinator>(this);
- private DartStringLiteral prefix;
+ private boolean exported;
+ private DartStringLiteral oldPrefix;
+
+ public DartImportDirective(DartStringLiteral libraryUri, DartIdentifier prefix, List<ImportCombinator> combinators, boolean exported) {
+ obsoleteFormat = false;
+ this.libraryUri = becomeParentOf(libraryUri);
+ this.prefix = becomeParentOf(prefix);
+ this.combinators.addAll(combinators);
+ this.exported = exported;
+ }
+
public DartImportDirective(DartStringLiteral libraryUri, DartBooleanLiteral exported, List<ImportCombinator> combinators, DartStringLiteral prefix) {
+ obsoleteFormat = true;
this.libraryUri = becomeParentOf(libraryUri);
- this.exported = becomeParentOf(exported);
this.combinators.addAll(combinators);
- this.prefix = becomeParentOf(prefix);
+ this.oldPrefix = becomeParentOf(prefix);
+ this.exported = exported != null;
}
public DartStringLiteral getLibraryUri() {
return libraryUri;
}
- public DartBooleanLiteral getExported() {
+ public boolean isExported() {
return exported;
}
+ public boolean isObsoleteFormat() {
+ // TODO(brianwilkerson) Remove this method once the obsolete format is no longer supported.
+ return obsoleteFormat;
+ }
+
public List<ImportCombinator> getCombinators() {
return combinators;
}
- public DartStringLiteral getPrefix() {
+ @Deprecated
+ public DartStringLiteral getOldPrefix() {
+ // TODO(brianwilkerson) Remove this method once the obsolete format is no longer supported.
+ return oldPrefix;
+ }
+
+ public DartIdentifier getPrefix() {
return prefix;
}
@Override
public void visitChildren(ASTVisitor<?> visitor) {
safelyVisitChild(libraryUri, visitor);
- safelyVisitChild(exported, visitor);
+ safelyVisitChild(prefix, visitor);
combinators.accept(visitor);
- safelyVisitChild(prefix, visitor);
+ safelyVisitChild(oldPrefix, visitor);
}
@Override

Powered by Google App Engine
This is Rietveld 408576698