| 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.
|
| */
|
|
|