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

Unified Diff: pkg/analysis_server/lib/src/services/index/store/codec.dart

Issue 1080503003: Move getElementAt() to CompilationUnitElement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | pkg/analyzer/lib/src/generated/element.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/index/store/codec.dart
diff --git a/pkg/analysis_server/lib/src/services/index/store/codec.dart b/pkg/analysis_server/lib/src/services/index/store/codec.dart
index 0283594d1e3ac0e08451bb4320e11992df6e70c0..f9190f084188f040fd0fb5e8af4c192337b2463b 100644
--- a/pkg/analysis_server/lib/src/services/index/store/codec.dart
+++ b/pkg/analysis_server/lib/src/services/index/store/codec.dart
@@ -81,21 +81,17 @@ class ElementCodec {
for (Source unitSource in unitSources) {
List<Source> libSources = context.getLibrariesContaining(unitSource);
for (Source libSource in libSources) {
- LibraryElement libraryElement = context.getLibraryElement(libSource);
- if (libraryElement == null) {
+ CompilationUnitElement unitElement =
+ context.getCompilationUnitElement(unitSource, libSource);
+ if (unitElement == null) {
return null;
}
if (kindId == ElementKind.LIBRARY.ordinal) {
- return libraryElement;
+ return unitElement.library;
} else if (kindId == ElementKind.COMPILATION_UNIT.ordinal) {
- for (CompilationUnitElement unit in libraryElement.units) {
- if (unit.source.fullName == filePath) {
- return unit;
- }
- }
- return null;
+ return unitElement;
} else {
- Element element = libraryElement.getElementAt(offset);
+ Element element = unitElement.getElementAt(offset);
if (element == null) {
return null;
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698