OLD | NEW |
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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 _resultRecorder = new AnalysisContextImpl_AnalysisTaskResultRecorder(this); | 1026 _resultRecorder = new AnalysisContextImpl_AnalysisTaskResultRecorder(this); |
1027 _privatePartition = new UniversalCachePartition(this, | 1027 _privatePartition = new UniversalCachePartition(this, |
1028 AnalysisOptionsImpl.DEFAULT_CACHE_SIZE, | 1028 AnalysisOptionsImpl.DEFAULT_CACHE_SIZE, |
1029 new AnalysisContextImpl_ContextRetentionPolicy(this)); | 1029 new AnalysisContextImpl_ContextRetentionPolicy(this)); |
1030 _cache = createCacheFromSourceFactory(null); | 1030 _cache = createCacheFromSourceFactory(null); |
1031 _onSourcesChangedController = | 1031 _onSourcesChangedController = |
1032 new StreamController<SourcesChangedEvent>.broadcast(); | 1032 new StreamController<SourcesChangedEvent>.broadcast(); |
1033 } | 1033 } |
1034 | 1034 |
1035 @override | 1035 @override |
| 1036 AnalysisCache get analysisCache => _cache; |
| 1037 |
| 1038 @override |
1036 AnalysisOptions get analysisOptions => _options; | 1039 AnalysisOptions get analysisOptions => _options; |
1037 | 1040 |
1038 @override | 1041 @override |
1039 void set analysisOptions(AnalysisOptions options) { | 1042 void set analysisOptions(AnalysisOptions options) { |
1040 bool needsRecompute = this._options.analyzeFunctionBodiesPredicate != | 1043 bool needsRecompute = this._options.analyzeFunctionBodiesPredicate != |
1041 options.analyzeFunctionBodiesPredicate || | 1044 options.analyzeFunctionBodiesPredicate || |
1042 this._options.generateImplicitErrors != | 1045 this._options.generateImplicitErrors != |
1043 options.generateImplicitErrors || | 1046 options.generateImplicitErrors || |
1044 this._options.generateSdkErrors != options.generateSdkErrors || | 1047 this._options.generateSdkErrors != options.generateSdkErrors || |
1045 this._options.dart2jsHint != options.dart2jsHint || | 1048 this._options.dart2jsHint != options.dart2jsHint || |
(...skipping 3004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4050 _workManager.add(source, SourcePriority.UNKNOWN); | 4053 _workManager.add(source, SourcePriority.UNKNOWN); |
4051 } | 4054 } |
4052 // reset unit in the notification, it is out of date now | 4055 // reset unit in the notification, it is out of date now |
4053 ChangeNoticeImpl notice = _pendingNotices[source]; | 4056 ChangeNoticeImpl notice = _pendingNotices[source]; |
4054 if (notice != null) { | 4057 if (notice != null) { |
4055 notice.resolvedDartUnit = null; | 4058 notice.resolvedDartUnit = null; |
4056 notice.resolvedHtmlUnit = null; | 4059 notice.resolvedHtmlUnit = null; |
4057 } | 4060 } |
4058 } | 4061 } |
4059 | 4062 |
4060 /** | |
4061 * Record the results produced by performing a [task] and return the cache | |
4062 * entry associated with the results. | |
4063 */ | |
4064 DartEntry _recordBuildUnitElementTask(BuildUnitElementTask task) { | |
4065 Source source = task.source; | |
4066 Source library = task.library; | |
4067 DartEntry dartEntry = _cache.get(source); | |
4068 CaughtException thrownException = task.exception; | |
4069 if (thrownException != null) { | |
4070 dartEntry.recordBuildElementErrorInLibrary(library, thrownException); | |
4071 throw new AnalysisException('<rethrow>', thrownException); | |
4072 } | |
4073 dartEntry.setValueInLibrary(DartEntry.BUILT_UNIT, library, task.unit); | |
4074 dartEntry.setValueInLibrary( | |
4075 DartEntry.BUILT_ELEMENT, library, task.unitElement); | |
4076 ChangeNoticeImpl notice = _getNotice(source); | |
4077 LineInfo lineInfo = dartEntry.getValue(SourceEntry.LINE_INFO); | |
4078 notice.setErrors(dartEntry.allErrors, lineInfo); | |
4079 return dartEntry; | |
4080 } | |
4081 | |
4082 // /** | 4063 // /** |
4083 // * Notify all of the analysis listeners that the given source is no longer i
ncluded in the set of | 4064 // * Notify all of the analysis listeners that the given source is no longer i
ncluded in the set of |
4084 // * sources that are being analyzed. | 4065 // * sources that are being analyzed. |
4085 // * | 4066 // * |
4086 // * @param source the source that is no longer being analyzed | 4067 // * @param source the source that is no longer being analyzed |
4087 // */ | 4068 // */ |
4088 // void _notifyExcludedSource(Source source) { | 4069 // void _notifyExcludedSource(Source source) { |
4089 // int count = _listeners.length; | 4070 // int count = _listeners.length; |
4090 // for (int i = 0; i < count; i++) { | 4071 // for (int i = 0; i < count; i++) { |
4091 // _listeners[i].excludedSource(this, source); | 4072 // _listeners[i].excludedSource(this, source); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4151 // * @param unit the result of resolving the source | 4132 // * @param unit the result of resolving the source |
4152 // */ | 4133 // */ |
4153 // void _notifyResolvedHtml(Source source, ht.HtmlUnit unit) { | 4134 // void _notifyResolvedHtml(Source source, ht.HtmlUnit unit) { |
4154 // int count = _listeners.length; | 4135 // int count = _listeners.length; |
4155 // for (int i = 0; i < count; i++) { | 4136 // for (int i = 0; i < count; i++) { |
4156 // _listeners[i].resolvedHtml(this, source, unit); | 4137 // _listeners[i].resolvedHtml(this, source, unit); |
4157 // } | 4138 // } |
4158 // } | 4139 // } |
4159 | 4140 |
4160 /** | 4141 /** |
| 4142 * Record the results produced by performing a [task] and return the cache |
| 4143 * entry associated with the results. |
| 4144 */ |
| 4145 DartEntry _recordBuildUnitElementTask(BuildUnitElementTask task) { |
| 4146 Source source = task.source; |
| 4147 Source library = task.library; |
| 4148 DartEntry dartEntry = _cache.get(source); |
| 4149 CaughtException thrownException = task.exception; |
| 4150 if (thrownException != null) { |
| 4151 dartEntry.recordBuildElementErrorInLibrary(library, thrownException); |
| 4152 throw new AnalysisException('<rethrow>', thrownException); |
| 4153 } |
| 4154 dartEntry.setValueInLibrary(DartEntry.BUILT_UNIT, library, task.unit); |
| 4155 dartEntry.setValueInLibrary( |
| 4156 DartEntry.BUILT_ELEMENT, library, task.unitElement); |
| 4157 ChangeNoticeImpl notice = _getNotice(source); |
| 4158 LineInfo lineInfo = dartEntry.getValue(SourceEntry.LINE_INFO); |
| 4159 notice.setErrors(dartEntry.allErrors, lineInfo); |
| 4160 return dartEntry; |
| 4161 } |
| 4162 |
| 4163 /** |
4161 * Given a [dartEntry] and a [library] element, record the library element and | 4164 * Given a [dartEntry] and a [library] element, record the library element and |
4162 * other information gleaned from the element in the cache entry. | 4165 * other information gleaned from the element in the cache entry. |
4163 */ | 4166 */ |
4164 void _recordElementData(DartEntry dartEntry, LibraryElement library, | 4167 void _recordElementData(DartEntry dartEntry, LibraryElement library, |
4165 Source librarySource, Source htmlSource) { | 4168 Source librarySource, Source htmlSource) { |
4166 dartEntry.setValue(DartEntry.ELEMENT, library); | 4169 dartEntry.setValue(DartEntry.ELEMENT, library); |
4167 dartEntry.setValue(DartEntry.IS_LAUNCHABLE, library.entryPoint != null); | 4170 dartEntry.setValue(DartEntry.IS_LAUNCHABLE, library.entryPoint != null); |
4168 dartEntry.setValue(DartEntry.IS_CLIENT, | 4171 dartEntry.setValue(DartEntry.IS_CLIENT, |
4169 _isClient(library, htmlSource, new HashSet<LibraryElement>())); | 4172 _isClient(library, htmlSource, new HashSet<LibraryElement>())); |
4170 } | 4173 } |
(...skipping 4841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9012 } | 9015 } |
9013 } | 9016 } |
9014 } | 9017 } |
9015 | 9018 |
9016 /** | 9019 /** |
9017 * Additional behavior for an analysis context that is required by internal | 9020 * Additional behavior for an analysis context that is required by internal |
9018 * users of the context. | 9021 * users of the context. |
9019 */ | 9022 */ |
9020 abstract class InternalAnalysisContext implements AnalysisContext { | 9023 abstract class InternalAnalysisContext implements AnalysisContext { |
9021 /** | 9024 /** |
| 9025 * A table mapping the sources known to the context to the information known |
| 9026 * about the source. |
| 9027 * |
| 9028 * TODO(scheglov) add the type, once we have only one cache. |
| 9029 */ |
| 9030 dynamic get analysisCache; |
| 9031 |
| 9032 /** |
9022 * Allow the client to supply its own content cache. This will take the | 9033 * Allow the client to supply its own content cache. This will take the |
9023 * place of the content cache created by default, allowing clients to share | 9034 * place of the content cache created by default, allowing clients to share |
9024 * the content cache between contexts. | 9035 * the content cache between contexts. |
9025 */ | 9036 */ |
9026 set contentCache(ContentCache value); | 9037 set contentCache(ContentCache value); |
9027 | 9038 |
9028 /** | 9039 /** |
9029 * Return a list of the explicit targets being analyzed by this context. | 9040 * Return a list of the explicit targets being analyzed by this context. |
9030 */ | 9041 */ |
9031 List<AnalysisTarget> get explicitTargets; | 9042 List<AnalysisTarget> get explicitTargets; |
(...skipping 2668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11700 visitElement(Element element) { | 11711 visitElement(Element element) { |
11701 if (element.id == _id) { | 11712 if (element.id == _id) { |
11702 result = element; | 11713 result = element; |
11703 throw new _ElementByIdFinderException(); | 11714 throw new _ElementByIdFinderException(); |
11704 } | 11715 } |
11705 super.visitElement(element); | 11716 super.visitElement(element); |
11706 } | 11717 } |
11707 } | 11718 } |
11708 | 11719 |
11709 class _ElementByIdFinderException {} | 11720 class _ElementByIdFinderException {} |
OLD | NEW |