| Index: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/contributor/IndexContributor.java
|
| diff --git a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/contributor/IndexContributor.java b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/contributor/IndexContributor.java
|
| index bf23137be24ad06d3dedeada6cd47c67fc8d9a34..cc1689405cdb22c0299b9f3b6f3876c6137a6399 100644
|
| --- a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/contributor/IndexContributor.java
|
| +++ b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/contributor/IndexContributor.java
|
| @@ -166,6 +166,8 @@ public class IndexContributor extends ASTVisitor<Void> {
|
| */
|
| private IntStack unnamedFunctionCount = new IntStack();
|
|
|
| + private DartImport[] libraryImports;
|
| +
|
| /**
|
| * Initialize a newly created contributor to contribute data and relationships to the given index
|
| * while processing the AST structure associated with the given compilation unit.
|
| @@ -182,6 +184,7 @@ public class IndexContributor extends ASTVisitor<Void> {
|
| this.compilationUnit = compilationUnit;
|
| libraryResource = getResource(library.getDefiningCompilationUnit());
|
| libraryElement = new Element(libraryResource, LIBRARY_ELEMENT_ID);
|
| + libraryImports = library.getImports();
|
| compilationUnitResource = getResource(compilationUnit);
|
| compilationUnitElement = new Element(
|
| compilationUnitResource,
|
| @@ -1189,14 +1192,12 @@ public class IndexContributor extends ASTVisitor<Void> {
|
| private void recordImportReference(LibraryElement importLibraryElement, String prefix, int offset) {
|
| try {
|
| DartLibrary importLibraryModel = BindingUtils.getDartElement(importLibraryElement);
|
| - CompilationUnit enclosingLibraryUnit = library.getDefiningCompilationUnit();
|
| - Resource enclosingLibraryResource = ResourceFactory.getResource(enclosingLibraryUnit);
|
| - for (DartImport imprt : library.getImports()) {
|
| + for (DartImport imprt : libraryImports) {
|
| if (Objects.equal(imprt.getLibrary(), importLibraryModel)
|
| && Objects.equal(imprt.getPrefix(), prefix)) {
|
| String imprtId = ElementFactory.composeElementId(imprt.getPrefix() + ":"
|
| + imprt.getLibrary().getElementName());
|
| - Element imprtElement = new Element(enclosingLibraryResource, imprtId);
|
| + Element imprtElement = new Element(libraryResource, imprtId);
|
| int length = StringUtils.length(prefix);
|
| Location location = createLocation(offset, length);
|
| recordRelationship(imprtElement, IndexConstants.IS_REFERENCED_BY, location);
|
|
|