| 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 26ef329a55ec0f099f398e59a26d13ee711fe412..9d50042f4bbe6748d89f6d4fc473b4cb5137ebe2 100644
|
| --- a/pkg/analyzer/lib/src/generated/engine.dart
|
| +++ b/pkg/analyzer/lib/src/generated/engine.dart
|
| @@ -1137,6 +1137,26 @@ class AnalysisContextImpl implements InternalAnalysisContext {
|
| return sources;
|
| }
|
|
|
| + Element findElementById(int id) {
|
| + _ElementByIdFinder finder = new _ElementByIdFinder(id);
|
| + try {
|
| + MapIterator<Source, SourceEntry> iterator = _cache.iterator();
|
| + while (iterator.moveNext()) {
|
| + SourceEntry sourceEntry = iterator.value;
|
| + if (sourceEntry.kind == SourceKind.LIBRARY) {
|
| + DartEntry dartEntry = sourceEntry;
|
| + LibraryElement library = dartEntry.getValue(DartEntry.ELEMENT);
|
| + if (library != null) {
|
| + library.accept(finder);
|
| + }
|
| + }
|
| + }
|
| + } on _ElementByIdFinderException catch (e) {
|
| + return finder.result;
|
| + }
|
| + return null;
|
| + }
|
| +
|
| @override
|
| List<Source> get librarySources => _getSources(SourceKind.LIBRARY);
|
|
|
| @@ -5013,6 +5033,25 @@ class AnalysisContextImpl implements InternalAnalysisContext {
|
| }
|
| }
|
|
|
| +class _ElementByIdFinder extends GeneralizingElementVisitor {
|
| + final int _id;
|
| + Element result;
|
| +
|
| + _ElementByIdFinder(this._id);
|
| +
|
| + @override
|
| + visitElement(Element element) {
|
| + if (element.id == _id) {
|
| + result = element;
|
| + throw new _ElementByIdFinderException();
|
| + }
|
| + super.visitElement(element);
|
| + }
|
| +}
|
| +
|
| +class _ElementByIdFinderException {
|
| +}
|
| +
|
| /**
|
| * An `AnalysisTaskResultRecorder` is used by an analysis context to record the
|
| * results of a task.
|
|
|