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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/Elements.java

Issue 10915008: Issue 4810. In case of import conflict explicitly report which library, with which prefix imported … (Closed) Base URL: https://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 | « no previous file | compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/resolver/Elements.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/Elements.java b/compiler/java/com/google/dart/compiler/resolver/Elements.java
index 53f8723649f93700f48e2d0c4b70101a12aeb8bc..075fa1d2d98f43997d0447bae43d5c8edeb647e6 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Elements.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Elements.java
@@ -20,10 +20,10 @@ import com.google.dart.compiler.ast.DartFunctionExpression;
import com.google.dart.compiler.ast.DartFunctionTypeAlias;
import com.google.dart.compiler.ast.DartIdentifier;
import com.google.dart.compiler.ast.DartLabel;
-import com.google.dart.compiler.ast.DartObsoleteMetadata;
import com.google.dart.compiler.ast.DartMethodDefinition;
import com.google.dart.compiler.ast.DartNativeBlock;
import com.google.dart.compiler.ast.DartNode;
+import com.google.dart.compiler.ast.DartObsoleteMetadata;
import com.google.dart.compiler.ast.DartParameter;
import com.google.dart.compiler.ast.DartSuperExpression;
import com.google.dart.compiler.ast.DartTypeNode;
@@ -595,6 +595,38 @@ static FieldElementImplementation fieldFromNode(DartField node,
}
/**
+ * @return the full location of the given {@link Element} - library and unit.
+ */
+ public static String getLibraryUnitLocation(Element element) {
+ try {
+ StringBuilder sb = new StringBuilder();
+ // library URI
+ String libraryUri;
+ {
+ LibraryUnit libraryUnit = getDeclaringLibrary(element).getLibraryUnit();
+ libraryUri = libraryUnit.getSource().getUri().toString();
+ sb.append(libraryUri);
+ }
+ // unit URI
+ SourceInfo sourceInfo = element.getSourceInfo();
+ {
+ String unitUri = sourceInfo.getSource().getUri().toString();
+ if (!unitUri.equals(libraryUri)) {
+ sb.append(" ");
+ sb.append(unitUri);
+ }
+ }
+ // line
+ sb.append(":");
+ sb.append(sourceInfo.getLine());
+ // done
+ return sb.toString();
+ } catch (Throwable e) {
+ return "<exception>";
+ }
+ }
+
+ /**
* @return the enclosing {@link ClassElement} (may be same if already given {@link ClassElement}),
* may be <code>null</code> if top level element.
*/
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698