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

Unified Diff: compiler/java/com/google/dart/compiler/ast/DartLibraryDirective.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/DartLibraryDirective.java
===================================================================
--- compiler/java/com/google/dart/compiler/ast/DartLibraryDirective.java (revision 10597)
+++ compiler/java/com/google/dart/compiler/ast/DartLibraryDirective.java (working copy)
@@ -8,16 +8,32 @@
* Implements the #library directive.
*/
public class DartLibraryDirective extends DartDirective {
- private DartStringLiteral name;
+ private DartExpression name;
- public DartLibraryDirective(DartStringLiteral name) {
+ public DartLibraryDirective(DartExpression name) {
this.name = becomeParentOf(name);
}
- public DartStringLiteral getName() {
+ public DartExpression getName() {
return name;
}
+ public String getLibraryName() {
+ if (name == null) {
+ return null;
+ } else if (name instanceof DartStringLiteral) {
+ // TODO(brianwilkerson) Remove this case once the obsolete format is no longer supported.
+ return ((DartStringLiteral) name).getValue();
+ } else {
+ return name.toSource();
+ }
+ }
+
+ public boolean isObsoleteFormat() {
+ // TODO(brianwilkerson) Remove this method once the obsolete format is no longer supported.
+ return name instanceof DartStringLiteral;
+ }
+
@Override
public void visitChildren(ASTVisitor<?> visitor) {
safelyVisitChild(name, visitor);

Powered by Google App Engine
This is Rietveld 408576698