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

Unified Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 736603005: Rollback r41807. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | « pkg/analyzer/lib/src/generated/element.dart ('k') | pkg/analyzer/test/generated/element_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/engine.dart
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 18dd254abb776c01935ce94e29da84012107dc92..62c2d0b8d001b83e82fe88aa54d5f299cd36f8ca 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -1713,16 +1713,22 @@ class AnalysisContextImpl implements InternalAnalysisContext {
Element getElement(ElementLocation location) {
// TODO(brianwilkerson) This should not be a "get" method.
try {
- if (location is DartElementLocation) {
- String libSourceEncoding = location.librarySourceEncoding;
- Source libSource = _computeSourceFromEncoding(libSourceEncoding);
- LibraryElementImpl libElement = computeLibraryElement(libSource);
- return libElement.getChildElement(
- location.unitSourceEncoding,
- location.nameOffset,
- location.kind);
- }
- // TODO(scheglov) add HtmlElementLocation
+ List<String> components = location.components;
+ Source source = _computeSourceFromEncoding(components[0]);
+ String sourceName = source.shortName;
+ if (AnalysisEngine.isDartFileName(sourceName)) {
+ ElementImpl element = computeLibraryElement(source) as ElementImpl;
+ for (int i = 1; i < components.length; i++) {
+ if (element == null) {
+ return null;
+ }
+ element = element.getChild(components[i]);
+ }
+ return element;
+ }
+ if (AnalysisEngine.isHtmlFileName(sourceName)) {
+ return computeHtmlElement(source);
+ }
} on AnalysisException catch (exception) {
}
return null;
« no previous file with comments | « pkg/analyzer/lib/src/generated/element.dart ('k') | pkg/analyzer/test/generated/element_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698