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

Unified Diff: compiler/java/com/google/dart/compiler/parser/DartPrefixParser.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/parser/DartPrefixParser.java
===================================================================
--- compiler/java/com/google/dart/compiler/parser/DartPrefixParser.java (revision 10597)
+++ compiler/java/com/google/dart/compiler/parser/DartPrefixParser.java (working copy)
@@ -15,6 +15,7 @@
import com.google.dart.compiler.DartCompilerListener;
import com.google.dart.compiler.Source;
+import com.google.dart.compiler.ast.DartIdentifier;
import com.google.dart.compiler.ast.DartImportDirective;
import com.google.dart.compiler.ast.DartStringLiteral;
import com.google.dart.compiler.metrics.CompilerMetrics;
@@ -38,15 +39,27 @@
super(source, sourceCode, isDietParse, prefixes, listener, compilerMetrics);
this.prefixes = prefixes;
}
-
+
+ @SuppressWarnings("deprecation")
@Override
protected DartImportDirective parseImportDirective() {
DartImportDirective directive = super.parseImportDirective();
- DartStringLiteral prefix = directive.getPrefix();
+ DartIdentifier prefix = directive.getPrefix();
if (prefix != null) {
- prefixes.add(prefix.getValue());
+ prefixes.add(prefix.getName());
}
return directive;
}
+
+ @SuppressWarnings("deprecation")
+ @Override
+ protected DartImportDirective parseObsoleteImportDirective() {
+ DartImportDirective directive = super.parseObsoleteImportDirective();
+ DartStringLiteral oldPrefix = directive.getOldPrefix();
+ if (oldPrefix != null) {
+ prefixes.add(oldPrefix.getValue());
+ }
+ return directive;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698