| 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 2388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2399 // If not, compute the information. Unless the modification date of the so
urce continues to | 2399 // If not, compute the information. Unless the modification date of the so
urce continues to |
| 2400 // change, this loop will eventually terminate. | 2400 // change, this loop will eventually terminate. |
| 2401 // | 2401 // |
| 2402 try { | 2402 try { |
| 2403 if (dartEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { | 2403 if (dartEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { |
| 2404 dartEntry = new GetContentTask(this, source).perform(_resultRecorder)
as DartEntry; | 2404 dartEntry = new GetContentTask(this, source).perform(_resultRecorder)
as DartEntry; |
| 2405 } | 2405 } |
| 2406 dartEntry = new ScanDartTask(this, source, dartEntry.modificationTime, d
artEntry.getValue(SourceEntry.CONTENT)).perform(_resultRecorder) as DartEntry; | 2406 dartEntry = new ScanDartTask(this, source, dartEntry.modificationTime, d
artEntry.getValue(SourceEntry.CONTENT)).perform(_resultRecorder) as DartEntry; |
| 2407 } on AnalysisException catch (exception) { | 2407 } on AnalysisException catch (exception) { |
| 2408 throw exception; | 2408 throw exception; |
| 2409 } on JavaException catch (exception, stackTrace) { | 2409 } catch (exception, stackTrace) { |
| 2410 throw new AnalysisException("Exception", new CaughtException(exception,
stackTrace)); | 2410 throw new AnalysisException("Exception", new CaughtException(exception,
stackTrace)); |
| 2411 } | 2411 } |
| 2412 state = dartEntry.getState(descriptor); | 2412 state = dartEntry.getState(descriptor); |
| 2413 } | 2413 } |
| 2414 return dartEntry; | 2414 return dartEntry; |
| 2415 } | 2415 } |
| 2416 | 2416 |
| 2417 /** | 2417 /** |
| 2418 * Given a source for a Dart file and the library that contains it, return a c
ache entry in which | 2418 * Given a source for a Dart file and the library that contains it, return a c
ache entry in which |
| 2419 * the state of the data represented by the given descriptor is either [CacheS
tate#VALID] or | 2419 * the state of the data represented by the given descriptor is either [CacheS
tate#VALID] or |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2481 // If not, compute the information. Unless the modification date of the so
urce continues to | 2481 // If not, compute the information. Unless the modification date of the so
urce continues to |
| 2482 // change, this loop will eventually terminate. | 2482 // change, this loop will eventually terminate. |
| 2483 // | 2483 // |
| 2484 try { | 2484 try { |
| 2485 if (htmlEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { | 2485 if (htmlEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { |
| 2486 htmlEntry = new GetContentTask(this, source).perform(_resultRecorder)
as HtmlEntry; | 2486 htmlEntry = new GetContentTask(this, source).perform(_resultRecorder)
as HtmlEntry; |
| 2487 } | 2487 } |
| 2488 htmlEntry = new ParseHtmlTask(this, source, htmlEntry.modificationTime,
htmlEntry.getValue(SourceEntry.CONTENT)).perform(_resultRecorder) as HtmlEntry; | 2488 htmlEntry = new ParseHtmlTask(this, source, htmlEntry.modificationTime,
htmlEntry.getValue(SourceEntry.CONTENT)).perform(_resultRecorder) as HtmlEntry; |
| 2489 } on AnalysisException catch (exception) { | 2489 } on AnalysisException catch (exception) { |
| 2490 throw exception; | 2490 throw exception; |
| 2491 } on JavaException catch (exception, stackTrace) { | 2491 } catch (exception, stackTrace) { |
| 2492 throw new AnalysisException("Exception", new CaughtException(exception,
stackTrace)); | 2492 throw new AnalysisException("Exception", new CaughtException(exception,
stackTrace)); |
| 2493 } | 2493 } |
| 2494 state = htmlEntry.getState(descriptor); | 2494 state = htmlEntry.getState(descriptor); |
| 2495 } | 2495 } |
| 2496 return htmlEntry; | 2496 return htmlEntry; |
| 2497 } | 2497 } |
| 2498 | 2498 |
| 2499 /** | 2499 /** |
| 2500 * Given a source for an HTML file, return a cache entry in which the state of
the data | 2500 * Given a source for an HTML file, return a cache entry in which the state of
the data |
| 2501 * represented by the given descriptor is either [CacheState#VALID] or | 2501 * represented by the given descriptor is either [CacheState#VALID] or |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3300 * | 3300 * |
| 3301 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. | 3301 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. |
| 3302 * | 3302 * |
| 3303 * @param source the source to be checked | 3303 * @param source the source to be checked |
| 3304 * @param sourceEntry the cache entry associated with the source | 3304 * @param sourceEntry the cache entry associated with the source |
| 3305 * @param isPriority `true` if the source is a priority source | 3305 * @param isPriority `true` if the source is a priority source |
| 3306 * @param hintsEnabled `true` if hints are currently enabled | 3306 * @param hintsEnabled `true` if hints are currently enabled |
| 3307 * @return the next task that needs to be performed for the given source | 3307 * @return the next task that needs to be performed for the given source |
| 3308 */ | 3308 */ |
| 3309 AnalysisContextImpl_TaskData _getNextAnalysisTaskForSource(Source source, Sour
ceEntry sourceEntry, bool isPriority, bool hintsEnabled) { | 3309 AnalysisContextImpl_TaskData _getNextAnalysisTaskForSource(Source source, Sour
ceEntry sourceEntry, bool isPriority, bool hintsEnabled) { |
| 3310 // Refuse to generate tasks for html based files that are above 1500 KB |
| 3311 // if (sourceEntry is HtmlEntryImpl && source is FileBasedSource) { |
| 3312 // // TODO (jwren) we still need to report an error of some kind back to th
e client. |
| 3313 // JavaFile file = (source as FileBasedSource).file; |
| 3314 // if (file.length() > (1500 * 1024)) { |
| 3315 // return new AnalysisContextImpl_TaskData(null, false); |
| 3316 // } |
| 3317 // } |
| 3310 if (sourceEntry == null) { | 3318 if (sourceEntry == null) { |
| 3311 return new AnalysisContextImpl_TaskData(null, false); | 3319 return new AnalysisContextImpl_TaskData(null, false); |
| 3312 } | 3320 } |
| 3313 CacheState contentState = sourceEntry.getState(SourceEntry.CONTENT); | 3321 CacheState contentState = sourceEntry.getState(SourceEntry.CONTENT); |
| 3314 if (contentState == CacheState.INVALID) { | 3322 if (contentState == CacheState.INVALID) { |
| 3315 return _createGetContentTask(source, sourceEntry); | 3323 return _createGetContentTask(source, sourceEntry); |
| 3316 } else if (contentState == CacheState.IN_PROCESS) { | 3324 } else if (contentState == CacheState.IN_PROCESS) { |
| 3317 // We are already in the process of getting the content. There's nothing e
lse we can do with | 3325 // We are already in the process of getting the content. There's nothing e
lse we can do with |
| 3318 // this source until that's complete. | 3326 // this source until that's complete. |
| 3319 return new AnalysisContextImpl_TaskData(null, true); | 3327 return new AnalysisContextImpl_TaskData(null, true); |
| (...skipping 2369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5689 * Ensure that there is a resolvable compilation unit available for all of the
compilation units | 5697 * Ensure that there is a resolvable compilation unit available for all of the
compilation units |
| 5690 * in the given library. | 5698 * in the given library. |
| 5691 * | 5699 * |
| 5692 * @param library the library for which resolvable compilation units must be a
vailable | 5700 * @param library the library for which resolvable compilation units must be a
vailable |
| 5693 * @return a list of (source, entry) pairs for all of the compilation units in
the library | 5701 * @return a list of (source, entry) pairs for all of the compilation units in
the library |
| 5694 */ | 5702 */ |
| 5695 List<CycleBuilder_SourceEntryPair> _ensurePartsInLibrary(ResolvableLibrary lib
rary) { | 5703 List<CycleBuilder_SourceEntryPair> _ensurePartsInLibrary(ResolvableLibrary lib
rary) { |
| 5696 List<CycleBuilder_SourceEntryPair> pairs = new List<CycleBuilder_SourceEntry
Pair>(); | 5704 List<CycleBuilder_SourceEntryPair> pairs = new List<CycleBuilder_SourceEntry
Pair>(); |
| 5697 Source librarySource = library.librarySource; | 5705 Source librarySource = library.librarySource; |
| 5698 DartEntry libraryEntry = AnalysisContextImpl_this._getReadableDartEntry(libr
arySource); | 5706 DartEntry libraryEntry = AnalysisContextImpl_this._getReadableDartEntry(libr
arySource); |
| 5699 if (libraryEntry != null && libraryEntry.getState(DartEntry.PARSED_UNIT) !=
CacheState.ERROR) { | 5707 if (libraryEntry == null) { |
| 5700 _ensureResolvableCompilationUnit(librarySource, libraryEntry); | 5708 throw new AnalysisException("Cannot find entry for ${librarySource.fullNam
e}"); |
| 5701 pairs.add(new CycleBuilder_SourceEntryPair(librarySource, libraryEntry)); | 5709 } else if (libraryEntry.getState(DartEntry.PARSED_UNIT) == CacheState.ERROR)
{ |
| 5702 List<Source> partSources = _getSources(librarySource, libraryEntry, DartEn
try.INCLUDED_PARTS); | 5710 throw new AnalysisException("Cannot compute parsed unit for ${librarySourc
e.fullName}"); |
| 5703 int count = partSources.length; | 5711 } |
| 5704 for (int i = 0; i < count; i++) { | 5712 _ensureResolvableCompilationUnit(librarySource, libraryEntry); |
| 5705 Source partSource = partSources[i]; | 5713 pairs.add(new CycleBuilder_SourceEntryPair(librarySource, libraryEntry)); |
| 5706 DartEntry partEntry = AnalysisContextImpl_this._getReadableDartEntry(par
tSource); | 5714 List<Source> partSources = _getSources(librarySource, libraryEntry, DartEntr
y.INCLUDED_PARTS); |
| 5707 if (partEntry != null && partEntry.getState(DartEntry.PARSED_UNIT) != Ca
cheState.ERROR) { | 5715 int count = partSources.length; |
| 5708 _ensureResolvableCompilationUnit(partSource, partEntry); | 5716 for (int i = 0; i < count; i++) { |
| 5709 pairs.add(new CycleBuilder_SourceEntryPair(partSource, partEntry)); | 5717 Source partSource = partSources[i]; |
| 5710 } | 5718 DartEntry partEntry = AnalysisContextImpl_this._getReadableDartEntry(partS
ource); |
| 5719 if (partEntry != null && partEntry.getState(DartEntry.PARSED_UNIT) != Cach
eState.ERROR) { |
| 5720 _ensureResolvableCompilationUnit(partSource, partEntry); |
| 5721 pairs.add(new CycleBuilder_SourceEntryPair(partSource, partEntry)); |
| 5711 } | 5722 } |
| 5712 } | 5723 } |
| 5713 return pairs; | 5724 return pairs; |
| 5714 } | 5725 } |
| 5715 | 5726 |
| 5716 /** | 5727 /** |
| 5717 * Ensure that there is a resolvable compilation unit available for the given
source. | 5728 * Ensure that there is a resolvable compilation unit available for the given
source. |
| 5718 * | 5729 * |
| 5719 * @param source the source for which a resolvable compilation unit must be av
ailable | 5730 * @param source the source for which a resolvable compilation unit must be av
ailable |
| 5720 * @param dartEntry the entry associated with the source | 5731 * @param dartEntry the entry associated with the source |
| (...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6628 * Perform this analysis task, ensuring that all exceptions are wrapped in an | 6639 * Perform this analysis task, ensuring that all exceptions are wrapped in an |
| 6629 * [AnalysisException]. | 6640 * [AnalysisException]. |
| 6630 * | 6641 * |
| 6631 * @throws AnalysisException if any exception occurs while performing the task | 6642 * @throws AnalysisException if any exception occurs while performing the task |
| 6632 */ | 6643 */ |
| 6633 void _safelyPerform() { | 6644 void _safelyPerform() { |
| 6634 try { | 6645 try { |
| 6635 internalPerform(); | 6646 internalPerform(); |
| 6636 } on AnalysisException catch (exception) { | 6647 } on AnalysisException catch (exception) { |
| 6637 throw exception; | 6648 throw exception; |
| 6638 } on JavaException catch (exception, stackTrace) { | 6649 } catch (exception, stackTrace) { |
| 6639 throw new AnalysisException("Exception", new CaughtException(exception, st
ackTrace)); | 6650 throw new AnalysisException("Exception", new CaughtException(exception, st
ackTrace)); |
| 6640 } | 6651 } |
| 6641 } | 6652 } |
| 6642 } | 6653 } |
| 6643 | 6654 |
| 6644 /** | 6655 /** |
| 6645 * The interface `AnalysisTaskVisitor` defines the behavior of objects that can
visit tasks. | 6656 * The interface `AnalysisTaskVisitor` defines the behavior of objects that can
visit tasks. |
| 6646 * While tasks are not structured in any interesting way, this class provides th
e ability to | 6657 * While tasks are not structured in any interesting way, this class provides th
e ability to |
| 6647 * dispatch to an appropriate method. | 6658 * dispatch to an appropriate method. |
| 6648 */ | 6659 */ |
| (...skipping 6653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13302 try { | 13313 try { |
| 13303 ht.AbstractScanner scanner = new ht.StringScanner(source, _content); | 13314 ht.AbstractScanner scanner = new ht.StringScanner(source, _content); |
| 13304 scanner.passThroughElements = <String> [_TAG_SCRIPT]; | 13315 scanner.passThroughElements = <String> [_TAG_SCRIPT]; |
| 13305 ht.Token token = scanner.tokenize(); | 13316 ht.Token token = scanner.tokenize(); |
| 13306 _lineInfo = new LineInfo(scanner.lineStarts); | 13317 _lineInfo = new LineInfo(scanner.lineStarts); |
| 13307 RecordingErrorListener errorListener = new RecordingErrorListener(); | 13318 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 13308 _unit = new ht.HtmlParser(source, errorListener).parse(token, _lineInfo); | 13319 _unit = new ht.HtmlParser(source, errorListener).parse(token, _lineInfo); |
| 13309 _unit.accept(new RecursiveXmlVisitor_ParseHtmlTask_internalPerform(this, e
rrorListener)); | 13320 _unit.accept(new RecursiveXmlVisitor_ParseHtmlTask_internalPerform(this, e
rrorListener)); |
| 13310 _errors = errorListener.getErrorsForSource(source); | 13321 _errors = errorListener.getErrorsForSource(source); |
| 13311 _referencedLibraries = librarySources; | 13322 _referencedLibraries = librarySources; |
| 13312 } on JavaException catch (exception, stackTrace) { | 13323 } catch (exception, stackTrace) { |
| 13313 throw new AnalysisException("Exception", new CaughtException(exception, st
ackTrace)); | 13324 throw new AnalysisException("Exception", new CaughtException(exception, st
ackTrace)); |
| 13314 } | 13325 } |
| 13315 } | 13326 } |
| 13316 | 13327 |
| 13317 /** | 13328 /** |
| 13318 * Return the sources of libraries that are referenced in the specified HTML f
ile. | 13329 * Return the sources of libraries that are referenced in the specified HTML f
ile. |
| 13319 * | 13330 * |
| 13320 * @return the sources of libraries that are referenced in the HTML file | 13331 * @return the sources of libraries that are referenced in the HTML file |
| 13321 */ | 13332 */ |
| 13322 List<Source> get librarySources { | 13333 List<Source> get librarySources { |
| (...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14909 @override | 14920 @override |
| 14910 void internalPerform() { | 14921 void internalPerform() { |
| 14911 RecordingErrorListener errorListener = new RecordingErrorListener(); | 14922 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 14912 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s
tart(); | 14923 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s
tart(); |
| 14913 try { | 14924 try { |
| 14914 Scanner scanner = new Scanner(source, new CharSequenceReader(_content), er
rorListener); | 14925 Scanner scanner = new Scanner(source, new CharSequenceReader(_content), er
rorListener); |
| 14915 scanner.preserveComments = context.analysisOptions.preserveComments; | 14926 scanner.preserveComments = context.analysisOptions.preserveComments; |
| 14916 _tokenStream = scanner.tokenize(); | 14927 _tokenStream = scanner.tokenize(); |
| 14917 _lineInfo = new LineInfo(scanner.lineStarts); | 14928 _lineInfo = new LineInfo(scanner.lineStarts); |
| 14918 _errors = errorListener.getErrorsForSource(source); | 14929 _errors = errorListener.getErrorsForSource(source); |
| 14919 } on JavaException catch (exception, stackTrace) { | 14930 } catch (exception, stackTrace) { |
| 14920 throw new AnalysisException("Exception", new CaughtException(exception, st
ackTrace)); | 14931 throw new AnalysisException("Exception", new CaughtException(exception, st
ackTrace)); |
| 14921 } finally { | 14932 } finally { |
| 14922 timeCounterScan.stop(); | 14933 timeCounterScan.stop(); |
| 14923 } | 14934 } |
| 14924 } | 14935 } |
| 14925 } | 14936 } |
| 14926 | 14937 |
| 14927 /** | 14938 /** |
| 14928 * Instances of the class `SdkAnalysisContext` implement an [AnalysisContext] th
at only | 14939 * Instances of the class `SdkAnalysisContext` implement an [AnalysisContext] th
at only |
| 14929 * contains sources for a Dart SDK. | 14940 * contains sources for a Dart SDK. |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15724 _index++; | 15735 _index++; |
| 15725 if (_index >= WorkManager_this._workQueues[_queueIndex].length) { | 15736 if (_index >= WorkManager_this._workQueues[_queueIndex].length) { |
| 15726 _index = 0; | 15737 _index = 0; |
| 15727 _queueIndex++; | 15738 _queueIndex++; |
| 15728 while (_queueIndex < WorkManager_this._workQueues.length && WorkManager_th
is._workQueues[_queueIndex].isEmpty) { | 15739 while (_queueIndex < WorkManager_this._workQueues.length && WorkManager_th
is._workQueues[_queueIndex].isEmpty) { |
| 15729 _queueIndex++; | 15740 _queueIndex++; |
| 15730 } | 15741 } |
| 15731 } | 15742 } |
| 15732 } | 15743 } |
| 15733 } | 15744 } |
| OLD | NEW |