| 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:collection'; | 10 import 'dart:collection'; |
| (...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1724 } | 1724 } |
| 1725 String taskDescription = task.toString(); | 1725 String taskDescription = task.toString(); |
| 1726 _notifyAboutToPerformTask(taskDescription); | 1726 _notifyAboutToPerformTask(taskDescription); |
| 1727 if (_TRACE_PERFORM_TASK) { | 1727 if (_TRACE_PERFORM_TASK) { |
| 1728 print(taskDescription); | 1728 print(taskDescription); |
| 1729 } | 1729 } |
| 1730 int performStart = JavaSystem.currentTimeMillis(); | 1730 int performStart = JavaSystem.currentTimeMillis(); |
| 1731 try { | 1731 try { |
| 1732 task.perform(_resultRecorder); | 1732 task.perform(_resultRecorder); |
| 1733 } on ObsoleteSourceAnalysisException catch (exception) { | 1733 } on ObsoleteSourceAnalysisException catch (exception) { |
| 1734 AnalysisEngine.instance.logger.logInformation2("Could not perform analysis
task: ${taskDescription}", exception); | 1734 AnalysisEngine.instance.logger.logInformation2("Could not perform analysis
task: $taskDescription", exception); |
| 1735 } on AnalysisException catch (exception) { | 1735 } on AnalysisException catch (exception) { |
| 1736 if (exception.cause is! JavaIOException) { | 1736 if (exception.cause is! JavaIOException) { |
| 1737 AnalysisEngine.instance.logger.logError2("Internal error while performin
g the task: ${task}", exception); | 1737 AnalysisEngine.instance.logger.logError2("Internal error while performin
g the task: $task", exception); |
| 1738 } | 1738 } |
| 1739 } | 1739 } |
| 1740 int performEnd = JavaSystem.currentTimeMillis(); | 1740 int performEnd = JavaSystem.currentTimeMillis(); |
| 1741 List<ChangeNotice> notices = _getChangeNotices(false); | 1741 List<ChangeNotice> notices = _getChangeNotices(false); |
| 1742 int noticeCount = notices.length; | 1742 int noticeCount = notices.length; |
| 1743 for (int i = 0; i < noticeCount; i++) { | 1743 for (int i = 0; i < noticeCount; i++) { |
| 1744 ChangeNotice notice = notices[i]; | 1744 ChangeNotice notice = notices[i]; |
| 1745 Source source = notice.source; | 1745 Source source = notice.source; |
| 1746 // TODO(brianwilkerson) Figure out whether the compilation unit is always
resolved, or whether | 1746 // TODO(brianwilkerson) Figure out whether the compilation unit is always
resolved, or whether |
| 1747 // we need to decide whether to invoke the "parsed" or "resolved" method.
This might be better | 1747 // we need to decide whether to invoke the "parsed" or "resolved" method.
This might be better |
| (...skipping 3297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5045 * loaded. | 5045 * loaded. |
| 5046 * | 5046 * |
| 5047 * @return `true` if the associated source is blocked waiting for its contents
to be | 5047 * @return `true` if the associated source is blocked waiting for its contents
to be |
| 5048 * loaded | 5048 * loaded |
| 5049 */ | 5049 */ |
| 5050 bool get isBlocked => _blocked; | 5050 bool get isBlocked => _blocked; |
| 5051 | 5051 |
| 5052 @override | 5052 @override |
| 5053 String toString() { | 5053 String toString() { |
| 5054 if (task == null) { | 5054 if (task == null) { |
| 5055 return "blocked: ${_blocked}"; | 5055 return "blocked: $_blocked"; |
| 5056 } | 5056 } |
| 5057 return task.toString(); | 5057 return task.toString(); |
| 5058 } | 5058 } |
| 5059 } | 5059 } |
| 5060 | 5060 |
| 5061 /** | 5061 /** |
| 5062 * The interface `AnalysisContextStatistics` defines access to statistics about
a single | 5062 * The interface `AnalysisContextStatistics` defines access to statistics about
a single |
| 5063 * [AnalysisContext]. | 5063 * [AnalysisContext]. |
| 5064 */ | 5064 */ |
| 5065 abstract class AnalysisContextStatistics { | 5065 abstract class AnalysisContextStatistics { |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5929 * | 5929 * |
| 5930 * @param visitor the visitor used to visit this task after it has completed | 5930 * @param visitor the visitor used to visit this task after it has completed |
| 5931 * @return the value returned by the visitor | 5931 * @return the value returned by the visitor |
| 5932 * @throws AnalysisException if the visitor throws the exception | 5932 * @throws AnalysisException if the visitor throws the exception |
| 5933 */ | 5933 */ |
| 5934 Object perform(AnalysisTaskVisitor visitor) { | 5934 Object perform(AnalysisTaskVisitor visitor) { |
| 5935 try { | 5935 try { |
| 5936 _safelyPerform(); | 5936 _safelyPerform(); |
| 5937 } on AnalysisException catch (exception, stackTrace) { | 5937 } on AnalysisException catch (exception, stackTrace) { |
| 5938 _thrownException = new CaughtException(exception, stackTrace); | 5938 _thrownException = new CaughtException(exception, stackTrace); |
| 5939 AnalysisEngine.instance.logger.logInformation2("Task failed: ${taskDescrip
tion}", new CaughtException(exception, stackTrace)); | 5939 AnalysisEngine.instance.logger.logInformation2("Task failed: $taskDescript
ion", new CaughtException(exception, stackTrace)); |
| 5940 } | 5940 } |
| 5941 return accept(visitor); | 5941 return accept(visitor); |
| 5942 } | 5942 } |
| 5943 | 5943 |
| 5944 @override | 5944 @override |
| 5945 String toString() => taskDescription; | 5945 String toString() => taskDescription; |
| 5946 | 5946 |
| 5947 /** | 5947 /** |
| 5948 * Return a textual description of this task. | 5948 * Return a textual description of this task. |
| 5949 * | 5949 * |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6365 if (angularElement is AngularHasTemplateElement) { | 6365 if (angularElement is AngularHasTemplateElement) { |
| 6366 AngularHasTemplateElement hasTemplate = angularElement; | 6366 AngularHasTemplateElement hasTemplate = angularElement; |
| 6367 angularElementsSources.add(angularElement.source); | 6367 angularElementsSources.add(angularElement.source); |
| 6368 String templateUri = hasTemplate.templateUri; | 6368 String templateUri = hasTemplate.templateUri; |
| 6369 if (templateUri == null) { | 6369 if (templateUri == null) { |
| 6370 continue; | 6370 continue; |
| 6371 } | 6371 } |
| 6372 try { | 6372 try { |
| 6373 Source templateSource = _context.sourceFactory.forUri2(_source.resolve
RelativeUri(parseUriWithException(templateUri))); | 6373 Source templateSource = _context.sourceFactory.forUri2(_source.resolve
RelativeUri(parseUriWithException(templateUri))); |
| 6374 if (!_context.exists(templateSource)) { | 6374 if (!_context.exists(templateSource)) { |
| 6375 templateSource = _context.sourceFactory.resolveUri(_source, "package
:${templateUri}"); | 6375 templateSource = _context.sourceFactory.resolveUri(_source, "package
:$templateUri"); |
| 6376 if (!_context.exists(templateSource)) { | 6376 if (!_context.exists(templateSource)) { |
| 6377 _errorListener.onError(new AnalysisError.con2(angularElement.sourc
e, hasTemplate.templateUriOffset, templateUri.length, AngularCode.URI_DOES_NOT_E
XIST, [templateUri])); | 6377 _errorListener.onError(new AnalysisError.con2(angularElement.sourc
e, hasTemplate.templateUriOffset, templateUri.length, AngularCode.URI_DOES_NOT_E
XIST, [templateUri])); |
| 6378 continue; | 6378 continue; |
| 6379 } | 6379 } |
| 6380 } | 6380 } |
| 6381 if (!AnalysisEngine.isHtmlFileName(templateUri)) { | 6381 if (!AnalysisEngine.isHtmlFileName(templateUri)) { |
| 6382 continue; | 6382 continue; |
| 6383 } | 6383 } |
| 6384 if (hasTemplate is AngularComponentElementImpl) { | 6384 if (hasTemplate is AngularComponentElementImpl) { |
| 6385 hasTemplate.templateSource = templateSource; | 6385 hasTemplate.templateSource = templateSource; |
| (...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7418 * Set the errors that changed as a result of the analysis to the given errors
and set the line | 7418 * Set the errors that changed as a result of the analysis to the given errors
and set the line |
| 7419 * information to the given line information. | 7419 * information to the given line information. |
| 7420 * | 7420 * |
| 7421 * @param errors the errors that changed as a result of the analysis | 7421 * @param errors the errors that changed as a result of the analysis |
| 7422 * @param lineInfo the line information associated with the source | 7422 * @param lineInfo the line information associated with the source |
| 7423 */ | 7423 */ |
| 7424 void setErrors(List<AnalysisError> errors, LineInfo lineInfo) { | 7424 void setErrors(List<AnalysisError> errors, LineInfo lineInfo) { |
| 7425 this._errors = errors; | 7425 this._errors = errors; |
| 7426 this._lineInfo = lineInfo; | 7426 this._lineInfo = lineInfo; |
| 7427 if (lineInfo == null) { | 7427 if (lineInfo == null) { |
| 7428 AnalysisEngine.instance.logger.logInformation2("No line info: ${source}",
new JavaException()); | 7428 AnalysisEngine.instance.logger.logInformation2("No line info: $source", ne
w JavaException()); |
| 7429 } | 7429 } |
| 7430 } | 7430 } |
| 7431 | 7431 |
| 7432 @override | 7432 @override |
| 7433 String toString() => "Changes for ${source.fullName}"; | 7433 String toString() => "Changes for ${source.fullName}"; |
| 7434 } | 7434 } |
| 7435 | 7435 |
| 7436 /** | 7436 /** |
| 7437 * Instances of the class `ChangeSet` indicate which sources have been added, ch
anged, | 7437 * Instances of the class `ChangeSet` indicate which sources have been added, ch
anged, |
| 7438 * removed, or deleted. In the case of a changed source, there are multiple ways
of indicating the | 7438 * removed, or deleted. In the case of a changed source, there are multiple ways
of indicating the |
| (...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8917 String get taskDescription => "get contents of ${source.fullName}"; | 8917 String get taskDescription => "get contents of ${source.fullName}"; |
| 8918 | 8918 |
| 8919 @override | 8919 @override |
| 8920 void internalPerform() { | 8920 void internalPerform() { |
| 8921 _complete = true; | 8921 _complete = true; |
| 8922 try { | 8922 try { |
| 8923 TimestampedData<String> data = context.getContents(source); | 8923 TimestampedData<String> data = context.getContents(source); |
| 8924 _content = data.data; | 8924 _content = data.data; |
| 8925 _modificationTime = data.modificationTime; | 8925 _modificationTime = data.modificationTime; |
| 8926 } catch (exception, stackTrace) { | 8926 } catch (exception, stackTrace) { |
| 8927 throw new AnalysisException("Could not get contents of ${source}", new Cau
ghtException(exception, stackTrace)); | 8927 throw new AnalysisException("Could not get contents of $source", new Caugh
tException(exception, stackTrace)); |
| 8928 } | 8928 } |
| 8929 } | 8929 } |
| 8930 } | 8930 } |
| 8931 | 8931 |
| 8932 /** | 8932 /** |
| 8933 * An `HtmlEntry` maintains the information cached by an analysis context about | 8933 * An `HtmlEntry` maintains the information cached by an analysis context about |
| 8934 * an individual HTML file. | 8934 * an individual HTML file. |
| 8935 */ | 8935 */ |
| 8936 class HtmlEntry extends SourceEntry { | 8936 class HtmlEntry extends SourceEntry { |
| 8937 /** | 8937 /** |
| (...skipping 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10675 return null; | 10675 return null; |
| 10676 } | 10676 } |
| 10677 if (code == UriValidationCode.URI_WITH_INTERPOLATION) { | 10677 if (code == UriValidationCode.URI_WITH_INTERPOLATION) { |
| 10678 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.URI_WITH_INTERPOLATION, [])); | 10678 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.URI_WITH_INTERPOLATION, [])); |
| 10679 return null; | 10679 return null; |
| 10680 } | 10680 } |
| 10681 if (code == UriValidationCode.INVALID_URI) { | 10681 if (code == UriValidationCode.INVALID_URI) { |
| 10682 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.INVALID_URI, [uriContent])); | 10682 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.INVALID_URI, [uriContent])); |
| 10683 return null; | 10683 return null; |
| 10684 } | 10684 } |
| 10685 throw new RuntimeException(message: "Failed to handle validation code: ${cod
e}"); | 10685 throw new RuntimeException(message: "Failed to handle validation code: $code
"); |
| 10686 } | 10686 } |
| 10687 | 10687 |
| 10688 /** | 10688 /** |
| 10689 * The source to be parsed. | 10689 * The source to be parsed. |
| 10690 */ | 10690 */ |
| 10691 final Source source; | 10691 final Source source; |
| 10692 | 10692 |
| 10693 /** | 10693 /** |
| 10694 * The head of the token stream used for parsing. | 10694 * The head of the token stream used for parsing. |
| 10695 */ | 10695 */ |
| (...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12209 List<AnalysisError> get resolutionErrors => _resolutionErrors; | 12209 List<AnalysisError> get resolutionErrors => _resolutionErrors; |
| 12210 | 12210 |
| 12211 /** | 12211 /** |
| 12212 * Return the [HtmlUnit] that was resolved by this task. | 12212 * Return the [HtmlUnit] that was resolved by this task. |
| 12213 * | 12213 * |
| 12214 * @return the [HtmlUnit] that was resolved by this task | 12214 * @return the [HtmlUnit] that was resolved by this task |
| 12215 */ | 12215 */ |
| 12216 ht.HtmlUnit get resolvedUnit => _resolvedUnit; | 12216 ht.HtmlUnit get resolvedUnit => _resolvedUnit; |
| 12217 | 12217 |
| 12218 @override | 12218 @override |
| 12219 String get taskDescription => "resolve as Angular template ${source}"; | 12219 String get taskDescription => "resolve as Angular template $source"; |
| 12220 | 12220 |
| 12221 @override | 12221 @override |
| 12222 void internalPerform() { | 12222 void internalPerform() { |
| 12223 // | 12223 // |
| 12224 // Prepare for resolution. | 12224 // Prepare for resolution. |
| 12225 // | 12225 // |
| 12226 RecordingErrorListener errorListener = new RecordingErrorListener(); | 12226 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 12227 LineInfo lineInfo = context.getLineInfo(source); | 12227 LineInfo lineInfo = context.getLineInfo(source); |
| 12228 // | 12228 // |
| 12229 // Perform resolution. | 12229 // Perform resolution. |
| (...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13164 * If the state of the value described by the given [descriptor] is changing | 13164 * If the state of the value described by the given [descriptor] is changing |
| 13165 * from ERROR to anything else, capture the information. This is an attempt to | 13165 * from ERROR to anything else, capture the information. This is an attempt to |
| 13166 * discover the underlying cause of a long-standing bug. | 13166 * discover the underlying cause of a long-standing bug. |
| 13167 */ | 13167 */ |
| 13168 void _validateStateChange(DataDescriptor descriptor, CacheState newState) { | 13168 void _validateStateChange(DataDescriptor descriptor, CacheState newState) { |
| 13169 if (descriptor != CONTENT) { | 13169 if (descriptor != CONTENT) { |
| 13170 return; | 13170 return; |
| 13171 } | 13171 } |
| 13172 CachedResult result = resultMap[CONTENT]; | 13172 CachedResult result = resultMap[CONTENT]; |
| 13173 if (result != null && result.state == CacheState.ERROR) { | 13173 if (result != null && result.state == CacheState.ERROR) { |
| 13174 String message = "contentState changing from ${result.state} to ${newState
}"; | 13174 String message = "contentState changing from ${result.state} to $newState"
; |
| 13175 InstrumentationBuilder builder = Instrumentation.builder2("SourceEntry-val
idateStateChange"); | 13175 InstrumentationBuilder builder = Instrumentation.builder2("SourceEntry-val
idateStateChange"); |
| 13176 builder.data3("message", message); | 13176 builder.data3("message", message); |
| 13177 //builder.data("source", source.getFullName()); | 13177 //builder.data("source", source.getFullName()); |
| 13178 builder.record(new CaughtException(new AnalysisException(message), null)); | 13178 builder.record(new CaughtException(new AnalysisException(message), null)); |
| 13179 builder.log(); | 13179 builder.log(); |
| 13180 } | 13180 } |
| 13181 } | 13181 } |
| 13182 } | 13182 } |
| 13183 | 13183 |
| 13184 /** | 13184 /** |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13472 _index++; | 13472 _index++; |
| 13473 if (_index >= _manager._workQueues[_queueIndex].length) { | 13473 if (_index >= _manager._workQueues[_queueIndex].length) { |
| 13474 _index = 0; | 13474 _index = 0; |
| 13475 _queueIndex++; | 13475 _queueIndex++; |
| 13476 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_
queueIndex].isEmpty) { | 13476 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_
queueIndex].isEmpty) { |
| 13477 _queueIndex++; | 13477 _queueIndex++; |
| 13478 } | 13478 } |
| 13479 } | 13479 } |
| 13480 } | 13480 } |
| 13481 } | 13481 } |
| OLD | NEW |