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: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/Library.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: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/Library.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/Library.java (revision 10597)
+++ editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/Library.java (working copy)
@@ -16,6 +16,7 @@
import com.google.dart.compiler.DartCompilationError;
import com.google.dart.compiler.LibrarySource;
import com.google.dart.compiler.ast.DartDirective;
+import com.google.dart.compiler.ast.DartIdentifier;
import com.google.dart.compiler.ast.DartImportDirective;
import com.google.dart.compiler.ast.DartSourceDirective;
import com.google.dart.compiler.ast.DartStringLiteral;
@@ -46,6 +47,7 @@
/**
* Construct a new library from the unresolved dart unit that defines the library
*/
+ @SuppressWarnings("deprecation")
static Library fromDartUnit(AnalysisServer server, File libFile, LibrarySource libSource,
Collection<DartDirective> directives) {
HashMap<String, File> imports = new HashMap<String, File>();
@@ -59,11 +61,18 @@
String relPath;
if (directive instanceof DartImportDirective) {
DartImportDirective importDirective = (DartImportDirective) directive;
- DartStringLiteral prefixLiteral = importDirective.getPrefix();
+ DartIdentifier prefix = importDirective.getPrefix();
+ if (prefix != null) {
+ String prefixName = prefix.getName();
+ if (prefixName != null) {
+ prefixes.add(prefixName);
+ }
+ }
+ DartStringLiteral prefixLiteral = importDirective.getOldPrefix();
if (prefixLiteral != null) {
- String prefix = prefixLiteral.getValue();
- if (prefix != null) {
- prefixes.add(prefix);
+ String prefixName = prefixLiteral.getValue();
+ if (prefixName != null) {
+ prefixes.add(prefixName);
}
}
relPath = importDirective.getLibraryUri().getValue();
@@ -128,8 +137,8 @@
/**
* Flag indicating if listeners should be notified when the library is parsed and resolved. This
- * is <code>false</code> when a library is reloaded from a cache file so that listeners will not
- * be notified because they were already notified when the library was first parsed and resolved.
+ * is <code>false</code> when a library is reloaded from a cache file so that listeners will not be
+ * notified because they were already notified when the library was first parsed and resolved.
*/
public final boolean shouldNotify;

Powered by Google App Engine
This is Rietveld 408576698