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

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/dart/ImportRewriteAnalyzer.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
« no previous file with comments | « editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/DartModelManager.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/dart/ImportRewriteAnalyzer.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/dart/ImportRewriteAnalyzer.java (revision 10597)
+++ editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/dart/ImportRewriteAnalyzer.java (working copy)
@@ -49,8 +49,8 @@
private IRegion sourceRange;
private int containerNameLength;
- public DirectiveDeclEntry(int containerNameLength, String elementName, String prefix,
- IRegion sourceRange) {
+ public DirectiveDeclEntry(
+ int containerNameLength, String elementName, String prefix, IRegion sourceRange) {
this.elementName = elementName;
this.prefix = prefix;
this.sourceRange = sourceRange;
@@ -632,8 +632,8 @@
PackageEntry curr = this.packageEntries.get(i);
if (!curr.isComment()) {
if (groupId == null || groupId.equals(curr.getGroupID())) {
- boolean preferrCurr = (bestMatch == null)
- || (curr.getNumberOfImports() > bestMatch.getNumberOfImports());
+ boolean preferrCurr = (bestMatch == null) || (curr.getNumberOfImports()
+ > bestMatch.getNumberOfImports());
if (matcher.isBetterMatch(curr.getName(), preferrCurr)) {
bestMatch = curr;
}
@@ -680,10 +680,6 @@
return directive.getLibraryUri().getValue();
}
- /**
- * @param root
- * @return
- */
private List<DartImportDirective> getImports(DartUnit root) {
List<DartDirective> directives = root.getDirectives();
List<DartImportDirective> imports = new ArrayList<DartImportDirective>();
@@ -712,9 +708,12 @@
return buf.toString();
}
+ @SuppressWarnings("deprecation")
private String getPrefix(DartImportDirective directive) {
if (directive.getPrefix() != null) {
- return directive.getPrefix().toString();
+ return directive.getPrefix().getName();
+ } else if (directive.getOldPrefix() != null) {
+ return directive.getOldPrefix().toString();
}
return null;
}
« no previous file with comments | « editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/DartModelManager.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698