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

Side by Side Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 738673002: Use shorter DartElementLocation. (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine; 8 library engine;
9 9
10 import "dart:math" as math; 10 import "dart:math" as math;
(...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1706 @override 1706 @override
1707 InternalAnalysisContext getContextFor(Source source) { 1707 InternalAnalysisContext getContextFor(Source source) {
1708 InternalAnalysisContext context = _cache.getContextFor(source); 1708 InternalAnalysisContext context = _cache.getContextFor(source);
1709 return context == null ? this : context; 1709 return context == null ? this : context;
1710 } 1710 }
1711 1711
1712 @override 1712 @override
1713 Element getElement(ElementLocation location) { 1713 Element getElement(ElementLocation location) {
1714 // TODO(brianwilkerson) This should not be a "get" method. 1714 // TODO(brianwilkerson) This should not be a "get" method.
1715 try { 1715 try {
1716 List<String> components = location.components; 1716 if (location is DartElementLocation) {
1717 Source source = _computeSourceFromEncoding(components[0]); 1717 String libSourceEncoding = location.librarySourceEncoding;
1718 String sourceName = source.shortName; 1718 Source libSource = _computeSourceFromEncoding(libSourceEncoding);
1719 if (AnalysisEngine.isDartFileName(sourceName)) { 1719 LibraryElementImpl libElement = computeLibraryElement(libSource);
1720 ElementImpl element = computeLibraryElement(source) as ElementImpl; 1720 return libElement.getChildElement(
1721 for (int i = 1; i < components.length; i++) { 1721 location.unitSourceEncoding,
1722 if (element == null) { 1722 location.nameOffset,
1723 return null; 1723 location.kind);
1724 }
1725 element = element.getChild(components[i]);
1726 }
1727 return element;
1728 } 1724 }
1729 if (AnalysisEngine.isHtmlFileName(sourceName)) { 1725 // TODO(scheglov) add HtmlElementLocation
1730 return computeHtmlElement(source);
1731 }
1732 } on AnalysisException catch (exception) { 1726 } on AnalysisException catch (exception) {
1733 } 1727 }
1734 return null; 1728 return null;
1735 } 1729 }
1736 1730
1737 @override 1731 @override
1738 AnalysisErrorInfo getErrors(Source source) { 1732 AnalysisErrorInfo getErrors(Source source) {
1739 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source); 1733 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source);
1740 if (sourceEntry is DartEntry) { 1734 if (sourceEntry is DartEntry) {
1741 DartEntry dartEntry = sourceEntry; 1735 DartEntry dartEntry = sourceEntry;
(...skipping 12946 matching lines...) Expand 10 before | Expand all | Expand 10 after
14688 14682
14689 @override 14683 @override
14690 Object visitPolymerTagDartElement(PolymerTagDartElement element) { 14684 Object visitPolymerTagDartElement(PolymerTagDartElement element) {
14691 if (element.name == PolymerHtmlUnitBuilder_this._elementName) { 14685 if (element.name == PolymerHtmlUnitBuilder_this._elementName) {
14692 throw new PolymerHtmlUnitBuilder_FoundTagDartElementError( 14686 throw new PolymerHtmlUnitBuilder_FoundTagDartElementError(
14693 element as PolymerTagDartElementImpl); 14687 element as PolymerTagDartElementImpl);
14694 } 14688 }
14695 return null; 14689 return null;
14696 } 14690 }
14697 } 14691 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698