| 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 2313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2324 "Internal error while performing the task: $task", | 2324 "Internal error while performing the task: $task", |
| 2325 new CaughtException(exception, stackTrace)); | 2325 new CaughtException(exception, stackTrace)); |
| 2326 } | 2326 } |
| 2327 } | 2327 } |
| 2328 int performEnd = JavaSystem.currentTimeMillis(); | 2328 int performEnd = JavaSystem.currentTimeMillis(); |
| 2329 List<ChangeNotice> notices = _getChangeNotices(false); | 2329 List<ChangeNotice> notices = _getChangeNotices(false); |
| 2330 int noticeCount = notices.length; | 2330 int noticeCount = notices.length; |
| 2331 for (int i = 0; i < noticeCount; i++) { | 2331 for (int i = 0; i < noticeCount; i++) { |
| 2332 ChangeNotice notice = notices[i]; | 2332 ChangeNotice notice = notices[i]; |
| 2333 Source source = notice.source; | 2333 Source source = notice.source; |
| 2334 |
| 2334 // TODO(brianwilkerson) Figure out whether the compilation unit is always | 2335 // TODO(brianwilkerson) Figure out whether the compilation unit is always |
| 2335 // resolved, or whether we need to decide whether to invoke the "parsed" | 2336 // resolved, or whether we need to decide whether to invoke the "parsed" |
| 2336 // or "resolved" method. This might be better done when recording task | 2337 // or "resolved" method. This might be better done when recording task |
| 2337 // results in order to reduce the chance of errors. | 2338 // results in order to reduce the chance of errors. |
| 2338 // if (notice.getCompilationUnit() != null) { | 2339 // if (notice.getCompilationUnit() != null) { |
| 2339 // notifyResolvedDart(source, notice.getCompilationUnit()); | 2340 // notifyResolvedDart(source, notice.getCompilationUnit()); |
| 2340 // } else if (notice.getHtmlUnit() != null) { | 2341 // } else if (notice.getHtmlUnit() != null) { |
| 2341 // notifyResolvedHtml(source, notice.getHtmlUnit()); | 2342 // notifyResolvedHtml(source, notice.getHtmlUnit()); |
| 2342 // } | 2343 // } |
| 2343 _notifyErrors(source, notice.errors, notice.lineInfo); | 2344 _notifyErrors(source, notice.errors, notice.lineInfo); |
| (...skipping 6431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8775 @override | 8776 @override |
| 8776 String get taskDescription => | 8777 String get taskDescription => |
| 8777 "generate errors and warnings for ${source.fullName}"; | 8778 "generate errors and warnings for ${source.fullName}"; |
| 8778 | 8779 |
| 8779 @override | 8780 @override |
| 8780 accept(AnalysisTaskVisitor visitor) => | 8781 accept(AnalysisTaskVisitor visitor) => |
| 8781 visitor.visitGenerateDartErrorsTask(this); | 8782 visitor.visitGenerateDartErrorsTask(this); |
| 8782 | 8783 |
| 8783 @override | 8784 @override |
| 8784 void internalPerform() { | 8785 void internalPerform() { |
| 8785 TimeCounter_TimeCounterHandle timeCounter = | 8786 PerformanceTag prevTag = PerformanceStatistics.errors.makeCurrent(); |
| 8786 PerformanceStatistics.errors.start(); | |
| 8787 try { | 8787 try { |
| 8788 RecordingErrorListener errorListener = new RecordingErrorListener(); | 8788 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 8789 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); | 8789 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); |
| 8790 TypeProvider typeProvider = context.typeProvider; | 8790 TypeProvider typeProvider = context.typeProvider; |
| 8791 // | 8791 // |
| 8792 // Validate the directives | 8792 // Validate the directives |
| 8793 // | 8793 // |
| 8794 validateDirectives(context, source, _unit, errorListener); | 8794 validateDirectives(context, source, _unit, errorListener); |
| 8795 // | 8795 // |
| 8796 // Use the ConstantVerifier to verify the use of constants. | 8796 // Use the ConstantVerifier to verify the use of constants. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 8807 // Use the ErrorVerifier to compute the rest of the errors. | 8807 // Use the ErrorVerifier to compute the rest of the errors. |
| 8808 // | 8808 // |
| 8809 ErrorVerifier errorVerifier = new ErrorVerifier( | 8809 ErrorVerifier errorVerifier = new ErrorVerifier( |
| 8810 errorReporter, | 8810 errorReporter, |
| 8811 libraryElement, | 8811 libraryElement, |
| 8812 typeProvider, | 8812 typeProvider, |
| 8813 new InheritanceManager(libraryElement)); | 8813 new InheritanceManager(libraryElement)); |
| 8814 _unit.accept(errorVerifier); | 8814 _unit.accept(errorVerifier); |
| 8815 _errors = errorListener.getErrorsForSource(source); | 8815 _errors = errorListener.getErrorsForSource(source); |
| 8816 } finally { | 8816 } finally { |
| 8817 timeCounter.stop(); | 8817 prevTag.makeCurrent(); |
| 8818 } | 8818 } |
| 8819 } | 8819 } |
| 8820 | 8820 |
| 8821 /** | 8821 /** |
| 8822 * Check each directive in the given compilation unit to see if the referenced
source exists and | 8822 * Check each directive in the given compilation unit to see if the referenced
source exists and |
| 8823 * report an error if it does not. | 8823 * report an error if it does not. |
| 8824 * | 8824 * |
| 8825 * @param context the context in which the library exists | 8825 * @param context the context in which the library exists |
| 8826 * @param librarySource the source representing the library containing the dir
ectives | 8826 * @param librarySource the source representing the library containing the dir
ectives |
| 8827 * @param unit the compilation unit containing the directives to be validated | 8827 * @param unit the compilation unit containing the directives to be validated |
| (...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10039 } | 10039 } |
| 10040 | 10040 |
| 10041 @override | 10041 @override |
| 10042 accept(AnalysisTaskVisitor visitor) => visitor.visitParseDartTask(this); | 10042 accept(AnalysisTaskVisitor visitor) => visitor.visitParseDartTask(this); |
| 10043 | 10043 |
| 10044 @override | 10044 @override |
| 10045 void internalPerform() { | 10045 void internalPerform() { |
| 10046 // | 10046 // |
| 10047 // Then parse the token stream. | 10047 // Then parse the token stream. |
| 10048 // | 10048 // |
| 10049 TimeCounter_TimeCounterHandle timeCounterParse = | 10049 PerformanceTag prevTag = PerformanceStatistics.parse.makeCurrent(); |
| 10050 PerformanceStatistics.parse.start(); | |
| 10051 try { | 10050 try { |
| 10052 RecordingErrorListener errorListener = new RecordingErrorListener(); | 10051 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 10053 Parser parser = new Parser(source, errorListener); | 10052 Parser parser = new Parser(source, errorListener); |
| 10054 AnalysisOptions options = context.analysisOptions; | 10053 AnalysisOptions options = context.analysisOptions; |
| 10055 parser.parseFunctionBodies = options.analyzeFunctionBodies; | 10054 parser.parseFunctionBodies = options.analyzeFunctionBodies; |
| 10056 _unit = parser.parseCompilationUnit(_tokenStream); | 10055 _unit = parser.parseCompilationUnit(_tokenStream); |
| 10057 _unit.lineInfo = lineInfo; | 10056 _unit.lineInfo = lineInfo; |
| 10058 AnalysisContext analysisContext = context; | 10057 AnalysisContext analysisContext = context; |
| 10059 for (Directive directive in _unit.directives) { | 10058 for (Directive directive in _unit.directives) { |
| 10060 if (directive is PartOfDirective) { | 10059 if (directive is PartOfDirective) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 10076 } else { | 10075 } else { |
| 10077 throw new AnalysisException( | 10076 throw new AnalysisException( |
| 10078 "$runtimeType failed to handle a ${directive.runtimeType}"); | 10077 "$runtimeType failed to handle a ${directive.runtimeType}"); |
| 10079 } | 10078 } |
| 10080 } | 10079 } |
| 10081 } | 10080 } |
| 10082 } | 10081 } |
| 10083 } | 10082 } |
| 10084 _errors = errorListener.getErrorsForSource(source); | 10083 _errors = errorListener.getErrorsForSource(source); |
| 10085 } finally { | 10084 } finally { |
| 10086 timeCounterParse.stop(); | 10085 prevTag.makeCurrent(); |
| 10087 } | 10086 } |
| 10088 } | 10087 } |
| 10089 | 10088 |
| 10090 /** | 10089 /** |
| 10091 * Efficiently convert the given set of sources to an array. | 10090 * Efficiently convert the given set of sources to an array. |
| 10092 * | 10091 * |
| 10093 * @param sources the set to be converted | 10092 * @param sources the set to be converted |
| 10094 * @return an array containing all of the sources in the given set | 10093 * @return an array containing all of the sources in the given set |
| 10095 */ | 10094 */ |
| 10096 List<Source> _toArray(HashSet<Source> sources) { | 10095 List<Source> _toArray(HashSet<Source> sources) { |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10463 void _onCancel() { | 10462 void _onCancel() { |
| 10464 _context._cancelFuture(this); | 10463 _context._cancelFuture(this); |
| 10465 } | 10464 } |
| 10466 } | 10465 } |
| 10467 | 10466 |
| 10468 /** | 10467 /** |
| 10469 * Container with global [AnalysisContext] performance statistics. | 10468 * Container with global [AnalysisContext] performance statistics. |
| 10470 */ | 10469 */ |
| 10471 class PerformanceStatistics { | 10470 class PerformanceStatistics { |
| 10472 /** | 10471 /** |
| 10473 * The [TimeCounter] for time spent in reading files. | 10472 * The [PerformanceTag] for time spent in reading files. |
| 10474 */ | 10473 */ |
| 10475 static TimeCounter io = new TimeCounter(); | 10474 static PerformanceTag io = new PerformanceTag('io'); |
| 10476 | 10475 |
| 10477 /** | 10476 /** |
| 10478 * The [TimeCounter] for time spent in scanning. | 10477 * The [PerformanceTag] for time spent in scanning. |
| 10479 */ | 10478 */ |
| 10480 static TimeCounter scan = new TimeCounter(); | 10479 static PerformanceTag scan = new PerformanceTag('scan'); |
| 10481 | 10480 |
| 10482 /** | 10481 /** |
| 10483 * The [TimeCounter] for time spent in parsing. | 10482 * The [PerformanceTag] for time spent in parsing. |
| 10484 */ | 10483 */ |
| 10485 static TimeCounter parse = new TimeCounter(); | 10484 static PerformanceTag parse = new PerformanceTag('parse'); |
| 10486 | 10485 |
| 10487 /** | 10486 /** |
| 10488 * The [TimeCounter] for time spent in resolving. | 10487 * The [PerformanceTag] for time spent in resolving. |
| 10489 */ | 10488 */ |
| 10490 static TimeCounter resolve = new TimeCounter(); | 10489 static PerformanceTag resolve = new PerformanceTag('resolve'); |
| 10491 | 10490 |
| 10492 /** | 10491 /** |
| 10493 * The [TimeCounter] for time spent in error verifier. | 10492 * The [PerformanceTag] for time spent in error verifier. |
| 10494 */ | 10493 */ |
| 10495 static TimeCounter errors = new TimeCounter(); | 10494 static PerformanceTag errors = new PerformanceTag('errors'); |
| 10496 | 10495 |
| 10497 /** | 10496 /** |
| 10498 * The [TimeCounter] for time spent in hints generator. | 10497 * The [PerformanceTag] for time spent in hints generator. |
| 10499 */ | 10498 */ |
| 10500 static TimeCounter hints = new TimeCounter(); | 10499 static PerformanceTag hints = new PerformanceTag('hints'); |
| 10501 | 10500 |
| 10502 /** | 10501 /** |
| 10503 * The [TimeCounter] for time spent in linting. | 10502 * The [PerformanceTag] for time spent in linting. |
| 10504 */ | 10503 */ |
| 10505 static TimeCounter lint = new TimeCounter(); | 10504 static PerformanceTag lint = new PerformanceTag('lint'); |
| 10506 | |
| 10507 /** | |
| 10508 * Reset all of the time counters to zero. | |
| 10509 */ | |
| 10510 static void reset() { | |
| 10511 io = new TimeCounter(); | |
| 10512 scan = new TimeCounter(); | |
| 10513 parse = new TimeCounter(); | |
| 10514 resolve = new TimeCounter(); | |
| 10515 errors = new TimeCounter(); | |
| 10516 hints = new TimeCounter(); | |
| 10517 lint = new TimeCounter(); | |
| 10518 } | |
| 10519 } | 10505 } |
| 10520 | 10506 |
| 10521 /** | 10507 /** |
| 10522 * Instances of the class `RecordingErrorListener` implement an error listener t
hat will | 10508 * Instances of the class `RecordingErrorListener` implement an error listener t
hat will |
| 10523 * record the errors that are reported to it in a way that is appropriate for ca
ching those errors | 10509 * record the errors that are reported to it in a way that is appropriate for ca
ching those errors |
| 10524 * within an analysis context. | 10510 * within an analysis context. |
| 10525 */ | 10511 */ |
| 10526 class RecordingErrorListener implements AnalysisErrorListener { | 10512 class RecordingErrorListener implements AnalysisErrorListener { |
| 10527 /** | 10513 /** |
| 10528 * A HashMap of lists containing the errors that were collected, keyed by each
[Source]. | 10514 * A HashMap of lists containing the errors that were collected, keyed by each
[Source]. |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11279 ResolverVisitor resolverVisitor = new ResolverVisitor.con2( | 11265 ResolverVisitor resolverVisitor = new ResolverVisitor.con2( |
| 11280 _libraryElement, | 11266 _libraryElement, |
| 11281 source, | 11267 source, |
| 11282 typeProvider, | 11268 typeProvider, |
| 11283 inheritanceManager, | 11269 inheritanceManager, |
| 11284 errorListener); | 11270 errorListener); |
| 11285 unit.accept(resolverVisitor); | 11271 unit.accept(resolverVisitor); |
| 11286 // | 11272 // |
| 11287 // Perform additional error checking. | 11273 // Perform additional error checking. |
| 11288 // | 11274 // |
| 11289 TimeCounter_TimeCounterHandle counterHandleErrors = | 11275 PerformanceTag prevTag = PerformanceStatistics.errors.makeCurrent(); |
| 11290 PerformanceStatistics.errors.start(); | |
| 11291 try { | 11276 try { |
| 11292 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); | 11277 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); |
| 11293 ErrorVerifier errorVerifier = new ErrorVerifier( | 11278 ErrorVerifier errorVerifier = new ErrorVerifier( |
| 11294 errorReporter, | 11279 errorReporter, |
| 11295 _libraryElement, | 11280 _libraryElement, |
| 11296 typeProvider, | 11281 typeProvider, |
| 11297 inheritanceManager); | 11282 inheritanceManager); |
| 11298 unit.accept(errorVerifier); | 11283 unit.accept(errorVerifier); |
| 11299 // TODO(paulberry): as a temporary workaround for issue 21572, | 11284 // TODO(paulberry): as a temporary workaround for issue 21572, |
| 11300 // ConstantVerifier is being run right after ConstantValueComputer, so we | 11285 // ConstantVerifier is being run right after ConstantValueComputer, so we |
| 11301 // don't need to run it here. Once issue 21572 is fixed, re-enable the | 11286 // don't need to run it here. Once issue 21572 is fixed, re-enable the |
| 11302 // call to ConstantVerifier. | 11287 // call to ConstantVerifier. |
| 11303 // ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter,
_libraryElement, typeProvider); | 11288 // ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter,
_libraryElement, typeProvider); |
| 11304 // unit.accept(constantVerifier); | 11289 // unit.accept(constantVerifier); |
| 11305 } finally { | 11290 } finally { |
| 11306 counterHandleErrors.stop(); | 11291 prevTag.makeCurrent(); |
| 11307 } | 11292 } |
| 11308 // | 11293 // |
| 11309 // Capture the results. | 11294 // Capture the results. |
| 11310 // | 11295 // |
| 11311 _resolvedUnit = unit; | 11296 _resolvedUnit = unit; |
| 11312 } | 11297 } |
| 11313 | 11298 |
| 11314 /** | 11299 /** |
| 11315 * Search the compilation units that are part of the given library and return
the element | 11300 * Search the compilation units that are part of the given library and return
the element |
| 11316 * representing the compilation unit with the given source. Return `null` if t
here is no | 11301 * representing the compilation unit with the given source. Return `null` if t
here is no |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11526 * @return the token stream that was produced by scanning the source | 11511 * @return the token stream that was produced by scanning the source |
| 11527 */ | 11512 */ |
| 11528 Token get tokenStream => _tokenStream; | 11513 Token get tokenStream => _tokenStream; |
| 11529 | 11514 |
| 11530 @override | 11515 @override |
| 11531 accept(AnalysisTaskVisitor visitor) => visitor.visitScanDartTask(this); | 11516 accept(AnalysisTaskVisitor visitor) => visitor.visitScanDartTask(this); |
| 11532 | 11517 |
| 11533 @override | 11518 @override |
| 11534 void internalPerform() { | 11519 void internalPerform() { |
| 11535 RecordingErrorListener errorListener = new RecordingErrorListener(); | 11520 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 11536 TimeCounter_TimeCounterHandle timeCounterScan = | 11521 PerformanceTag prevTag = PerformanceStatistics.scan.makeCurrent(); |
| 11537 PerformanceStatistics.scan.start(); | |
| 11538 try { | 11522 try { |
| 11539 Scanner scanner = | 11523 Scanner scanner = |
| 11540 new Scanner(source, new CharSequenceReader(_content), errorListener); | 11524 new Scanner(source, new CharSequenceReader(_content), errorListener); |
| 11541 scanner.preserveComments = context.analysisOptions.preserveComments; | 11525 scanner.preserveComments = context.analysisOptions.preserveComments; |
| 11542 _tokenStream = scanner.tokenize(); | 11526 _tokenStream = scanner.tokenize(); |
| 11543 _lineInfo = new LineInfo(scanner.lineStarts); | 11527 _lineInfo = new LineInfo(scanner.lineStarts); |
| 11544 _errors = errorListener.getErrorsForSource(source); | 11528 _errors = errorListener.getErrorsForSource(source); |
| 11545 } catch (exception, stackTrace) { | 11529 } catch (exception, stackTrace) { |
| 11546 throw new AnalysisException( | 11530 throw new AnalysisException( |
| 11547 "Exception", | 11531 "Exception", |
| 11548 new CaughtException(exception, stackTrace)); | 11532 new CaughtException(exception, stackTrace)); |
| 11549 } finally { | 11533 } finally { |
| 11550 timeCounterScan.stop(); | 11534 prevTag.makeCurrent(); |
| 11551 } | 11535 } |
| 11552 } | 11536 } |
| 11553 } | 11537 } |
| 11554 | 11538 |
| 11555 /** | 11539 /** |
| 11556 * Instances of the class `SdkAnalysisContext` implement an [AnalysisContext] th
at only | 11540 * Instances of the class `SdkAnalysisContext` implement an [AnalysisContext] th
at only |
| 11557 * contains sources for a Dart SDK. | 11541 * contains sources for a Dart SDK. |
| 11558 */ | 11542 */ |
| 11559 class SdkAnalysisContext extends AnalysisContextImpl { | 11543 class SdkAnalysisContext extends AnalysisContextImpl { |
| 11560 @override | 11544 @override |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12425 if (element.id == _id) { | 12409 if (element.id == _id) { |
| 12426 result = element; | 12410 result = element; |
| 12427 throw new _ElementByIdFinderException(); | 12411 throw new _ElementByIdFinderException(); |
| 12428 } | 12412 } |
| 12429 super.visitElement(element); | 12413 super.visitElement(element); |
| 12430 } | 12414 } |
| 12431 } | 12415 } |
| 12432 | 12416 |
| 12433 class _ElementByIdFinderException { | 12417 class _ElementByIdFinderException { |
| 12434 } | 12418 } |
| OLD | NEW |