try {
String[] components = location.getComponents();
Source source = computeSourceFromEncoding(components[0]);
String sourceName = source.getShortName();
if (AnalysisEngine.isDartFileName(sourceName)) {
ElementImpl element = (ElementImpl) computeLibraryElement(source);
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);