Chromium Code Reviews| Index: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/ast/DartElementLocator.java |
| =================================================================== |
| --- editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/ast/DartElementLocator.java (revision 8002) |
| +++ editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/ast/DartElementLocator.java (working copy) |
| @@ -424,17 +424,21 @@ |
| if (Objects.equal(compilationUnit, library.getDefiningCompilationUnit())) { |
| DartImport[] imports = library.getImports(); |
| for (DartImport imprt : imports) { |
| + SourceRange uriRange = imprt.getUriRange(); |
|
scheglov
2012/05/25 17:26:36
If this variable is used only in "if", please move
Brian Wilkerson
2012/05/25 17:37:10
Done.
|
| // on URI of library - return defining Unit of imported Library |
| - if (SourceRangeUtils.contains(imprt.getUriRange(), startOffset)) { |
| + if (SourceRangeUtils.contains(uriRange, startOffset)) { |
| resolvedElement = null; |
| foundElement = imprt.getLibrary().getDefiningCompilationUnit(); |
| + wordRegion = new Region(uriRange.getOffset(), uriRange.getLength()); |
| + candidateRegion = new Region(0, 0); |
| throw new DartElementFoundException(); |
| } |
| // on #import directive - return DartImport element |
| - if (SourceRangeUtils.contains(imprt.getSourceRange(), startOffset)) { |
| + SourceRange sourceRange = imprt.getSourceRange(); |
| + if (SourceRangeUtils.contains(sourceRange, startOffset)) { |
| resolvedElement = null; |
| foundElement = imprt; |
| - SourceRange sourceRange = imprt.getSourceRange(); |
| + wordRegion = new Region(sourceRange.getOffset(), sourceRange.getLength()); |
| candidateRegion = new Region(sourceRange.getOffset(), sourceRange.getLength()); |
| throw new DartElementFoundException(); |
| } |