| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 library engine; | 3 library engine; |
| 4 import 'java_core.dart'; | 4 import 'java_core.dart'; |
| 5 import 'java_engine.dart'; | 5 import 'java_engine.dart'; |
| 6 import 'utilities_collection.dart'; | 6 import 'utilities_collection.dart'; |
| 7 import 'utilities_general.dart'; | 7 import 'utilities_general.dart'; |
| 8 import 'instrumentation.dart'; | 8 import 'instrumentation.dart'; |
| 9 import 'error.dart'; | 9 import 'error.dart'; |
| 10 import 'source.dart'; | 10 import 'source.dart'; |
| (...skipping 3348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3359 | 3359 |
| 3360 /** | 3360 /** |
| 3361 * Return `true` if the modification times of the sources used by the given li
brary resolver | 3361 * Return `true` if the modification times of the sources used by the given li
brary resolver |
| 3362 * to resolve one or more libraries are consistent with the modification times
in the cache. | 3362 * to resolve one or more libraries are consistent with the modification times
in the cache. |
| 3363 * | 3363 * |
| 3364 * @param resolver the library resolver used to resolve one or more libraries | 3364 * @param resolver the library resolver used to resolve one or more libraries |
| 3365 * @return `true` if we should record the results of the resolution | 3365 * @return `true` if we should record the results of the resolution |
| 3366 * @throws AnalysisException if any of the modification times could not be det
ermined (this should | 3366 * @throws AnalysisException if any of the modification times could not be det
ermined (this should |
| 3367 * not happen) | 3367 * not happen) |
| 3368 */ | 3368 */ |
| 3369 bool allModificationTimesMatch(LibraryResolver resolver) { | 3369 bool allModificationTimesMatch(Set<Library> resolvedLibraries) { |
| 3370 bool allTimesMatch = true; | 3370 bool allTimesMatch = true; |
| 3371 for (Library library in resolver.resolvedLibraries) { | 3371 for (Library library in resolvedLibraries) { |
| 3372 for (Source source in library.compilationUnitSources) { | 3372 for (Source source in library.compilationUnitSources) { |
| 3373 DartEntry dartEntry = getReadableDartEntry(source); | 3373 DartEntry dartEntry = getReadableDartEntry(source); |
| 3374 if (dartEntry == null) { | 3374 if (dartEntry == null) { |
| 3375 throw new AnalysisException.con1("Internal error: attempting to reolve
non-Dart file as a Dart file: ${source.fullName}"); | 3375 throw new AnalysisException.con1("Internal error: attempting to reolve
non-Dart file as a Dart file: ${source.fullName}"); |
| 3376 } | 3376 } |
| 3377 int sourceTime = source.modificationStamp; | 3377 int sourceTime = source.modificationStamp; |
| 3378 int resultTime = library.getModificationTime(source); | 3378 int resultTime = library.getModificationTime(source); |
| 3379 if (sourceTime != resultTime) { | 3379 if (sourceTime != resultTime) { |
| 3380 sourceChanged(source); | 3380 sourceChanged(source); |
| 3381 allTimesMatch = false; | 3381 allTimesMatch = false; |
| (...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4471 * @param task the task that was performed | 4471 * @param task the task that was performed |
| 4472 * @return an entry containing the computed results | 4472 * @return an entry containing the computed results |
| 4473 * @throws AnalysisException if the results could not be recorded | 4473 * @throws AnalysisException if the results could not be recorded |
| 4474 */ | 4474 */ |
| 4475 DartEntry recordResolveDartLibraryTaskResults(ResolveDartLibraryTask task) { | 4475 DartEntry recordResolveDartLibraryTaskResults(ResolveDartLibraryTask task) { |
| 4476 LibraryResolver resolver = task.libraryResolver; | 4476 LibraryResolver resolver = task.libraryResolver; |
| 4477 AnalysisException thrownException = task.exception; | 4477 AnalysisException thrownException = task.exception; |
| 4478 DartEntry unitEntry = null; | 4478 DartEntry unitEntry = null; |
| 4479 Source unitSource = task.unitSource; | 4479 Source unitSource = task.unitSource; |
| 4480 if (resolver != null) { | 4480 if (resolver != null) { |
| 4481 Set<Library> resolvedLibraries = resolver.resolvedLibraries; |
| 4482 if (resolvedLibraries == null) { |
| 4483 unitEntry = getReadableDartEntry(unitSource); |
| 4484 if (unitEntry == null) { |
| 4485 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${unitSource.fullName}"); |
| 4486 } |
| 4487 DartEntryImpl dartCopy = unitEntry.writableCopy; |
| 4488 dartCopy.recordResolutionError(); |
| 4489 dartCopy.exception = thrownException; |
| 4490 _cache.put(unitSource, dartCopy); |
| 4491 if (thrownException != null) { |
| 4492 throw thrownException; |
| 4493 } |
| 4494 return dartCopy; |
| 4495 } |
| 4481 { | 4496 { |
| 4482 if (allModificationTimesMatch(resolver)) { | 4497 if (allModificationTimesMatch(resolvedLibraries)) { |
| 4483 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); | 4498 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); |
| 4484 RecordingErrorListener errorListener = resolver.errorListener; | 4499 RecordingErrorListener errorListener = resolver.errorListener; |
| 4485 for (Library library in resolver.resolvedLibraries) { | 4500 for (Library library in resolvedLibraries) { |
| 4486 Source librarySource = library.librarySource; | 4501 Source librarySource = library.librarySource; |
| 4487 for (Source source in library.compilationUnitSources) { | 4502 for (Source source in library.compilationUnitSources) { |
| 4488 CompilationUnit unit = library.getAST(source); | 4503 CompilationUnit unit = library.getAST(source); |
| 4489 List<AnalysisError> errors = errorListener.getErrors2(source); | 4504 List<AnalysisError> errors = errorListener.getErrors2(source); |
| 4490 unit.resolutionErrors = errors; | 4505 unit.resolutionErrors = errors; |
| 4491 LineInfo lineInfo = unit.lineInfo; | 4506 LineInfo lineInfo = unit.lineInfo; |
| 4492 DartEntry dartEntry = _cache.get(source) as DartEntry; | 4507 DartEntry dartEntry = _cache.get(source) as DartEntry; |
| 4493 int sourceTime = source.modificationStamp; | 4508 int sourceTime = source.modificationStamp; |
| 4494 if (dartEntry.modificationTime != sourceTime) { | 4509 if (dartEntry.modificationTime != sourceTime) { |
| 4495 sourceChanged(source); | 4510 sourceChanged(source); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 4514 _cache.put(source, dartCopy); | 4529 _cache.put(source, dartCopy); |
| 4515 if (source == unitSource) { | 4530 if (source == unitSource) { |
| 4516 unitEntry = dartCopy; | 4531 unitEntry = dartCopy; |
| 4517 } | 4532 } |
| 4518 ChangeNoticeImpl notice = getNotice(source); | 4533 ChangeNoticeImpl notice = getNotice(source); |
| 4519 notice.compilationUnit = unit; | 4534 notice.compilationUnit = unit; |
| 4520 notice.setErrors(dartCopy.allErrors, lineInfo); | 4535 notice.setErrors(dartCopy.allErrors, lineInfo); |
| 4521 } | 4536 } |
| 4522 } | 4537 } |
| 4523 } else { | 4538 } else { |
| 4524 for (Library library in resolver.resolvedLibraries) { | 4539 for (Library library in resolvedLibraries) { |
| 4525 for (Source source in library.compilationUnitSources) { | 4540 for (Source source in library.compilationUnitSources) { |
| 4526 DartEntry dartEntry = getReadableDartEntry(source); | 4541 DartEntry dartEntry = getReadableDartEntry(source); |
| 4527 if (dartEntry != null) { | 4542 if (dartEntry != null) { |
| 4528 int resultTime = library.getModificationTime(source); | 4543 int resultTime = library.getModificationTime(source); |
| 4529 DartEntryImpl dartCopy = dartEntry.writableCopy; | 4544 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 4530 if (thrownException == null || resultTime >= 0) { | 4545 if (thrownException == null || resultTime >= 0) { |
| 4531 dartCopy.recordResolutionNotInProcess(); | 4546 dartCopy.recordResolutionNotInProcess(); |
| 4532 } else { | 4547 } else { |
| 4533 dartCopy.recordResolutionError(); | 4548 dartCopy.recordResolutionError(); |
| 4534 } | 4549 } |
| (...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6460 String get taskDescription { | 6475 String get taskDescription { |
| 6461 if (source == null) { | 6476 if (source == null) { |
| 6462 return "parse as dart null source"; | 6477 return "parse as dart null source"; |
| 6463 } | 6478 } |
| 6464 return "parse as dart ${source.fullName}"; | 6479 return "parse as dart ${source.fullName}"; |
| 6465 } | 6480 } |
| 6466 void internalPerform() { | 6481 void internalPerform() { |
| 6467 RecordingErrorListener errorListener = new RecordingErrorListener(); | 6482 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 6468 List<Token> token = [null]; | 6483 List<Token> token = [null]; |
| 6469 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s
tart(); | 6484 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s
tart(); |
| 6470 Source_ContentReceiver receiver = new Source_ContentReceiver_9(this, errorLi
stener, token); | |
| 6471 try { | 6485 try { |
| 6472 source.getContents(receiver); | 6486 Source_ContentReceiver receiver = new Source_ContentReceiver_9(this, error
Listener, token); |
| 6473 } on JavaException catch (exception) { | 6487 try { |
| 6474 modificationTime = source.modificationStamp; | 6488 source.getContents(receiver); |
| 6475 throw new AnalysisException.con3(exception); | 6489 } on JavaException catch (exception) { |
| 6490 modificationTime = source.modificationStamp; |
| 6491 throw new AnalysisException.con3(exception); |
| 6492 } |
| 6493 } finally { |
| 6494 timeCounterScan.stop(); |
| 6476 } | 6495 } |
| 6477 timeCounterScan.stop(); | |
| 6478 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); | 6496 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); |
| 6479 Parser parser = new Parser(source, errorListener); | 6497 try { |
| 6480 compilationUnit = parser.parseCompilationUnit(token[0]); | 6498 Parser parser = new Parser(source, errorListener); |
| 6481 errors = errorListener.getErrors2(source); | 6499 compilationUnit = parser.parseCompilationUnit(token[0]); |
| 6482 for (Directive directive in compilationUnit.directives) { | 6500 errors = errorListener.getErrors2(source); |
| 6483 if (directive is ExportDirective) { | 6501 for (Directive directive in compilationUnit.directives) { |
| 6484 Source exportSource = resolveSource(source, directive as ExportDirective
); | 6502 if (directive is ExportDirective) { |
| 6485 if (exportSource != null) { | 6503 Source exportSource = resolveSource(source, directive as ExportDirecti
ve); |
| 6486 javaSetAdd(_exportedSources, exportSource); | 6504 if (exportSource != null) { |
| 6505 javaSetAdd(_exportedSources, exportSource); |
| 6506 } |
| 6507 } else if (directive is ImportDirective) { |
| 6508 Source importSource = resolveSource(source, directive as ImportDirecti
ve); |
| 6509 if (importSource != null) { |
| 6510 javaSetAdd(_importedSources, importSource); |
| 6511 } |
| 6512 } else if (directive is LibraryDirective) { |
| 6513 _hasLibraryDirective2 = true; |
| 6514 } else if (directive is PartDirective) { |
| 6515 Source partSource = resolveSource(source, directive as PartDirective); |
| 6516 if (partSource != null) { |
| 6517 javaSetAdd(_includedSources, partSource); |
| 6518 } |
| 6519 } else if (directive is PartOfDirective) { |
| 6520 _hasPartOfDirective2 = true; |
| 6487 } | 6521 } |
| 6488 } else if (directive is ImportDirective) { | |
| 6489 Source importSource = resolveSource(source, directive as ImportDirective
); | |
| 6490 if (importSource != null) { | |
| 6491 javaSetAdd(_importedSources, importSource); | |
| 6492 } | |
| 6493 } else if (directive is LibraryDirective) { | |
| 6494 _hasLibraryDirective2 = true; | |
| 6495 } else if (directive is PartDirective) { | |
| 6496 Source partSource = resolveSource(source, directive as PartDirective); | |
| 6497 if (partSource != null) { | |
| 6498 javaSetAdd(_includedSources, partSource); | |
| 6499 } | |
| 6500 } else if (directive is PartOfDirective) { | |
| 6501 _hasPartOfDirective2 = true; | |
| 6502 } | 6522 } |
| 6523 compilationUnit.parsingErrors = errors; |
| 6524 compilationUnit.lineInfo = lineInfo; |
| 6525 } finally { |
| 6526 timeCounterParse.stop(); |
| 6503 } | 6527 } |
| 6504 compilationUnit.parsingErrors = errors; | |
| 6505 compilationUnit.lineInfo = lineInfo; | |
| 6506 timeCounterParse.stop(); | |
| 6507 } | 6528 } |
| 6508 | 6529 |
| 6509 /** | 6530 /** |
| 6510 * Return the result of resolving the URI of the given URI-based directive aga
inst the URI of the | 6531 * Return the result of resolving the URI of the given URI-based directive aga
inst the URI of the |
| 6511 * given library, or `null` if the URI is not valid. | 6532 * given library, or `null` if the URI is not valid. |
| 6512 * | 6533 * |
| 6513 * @param librarySource the source representing the library containing the dir
ective | 6534 * @param librarySource the source representing the library containing the dir
ective |
| 6514 * @param directive the directive which URI should be resolved | 6535 * @param directive the directive which URI should be resolved |
| 6515 * @return the result of resolving the URI against the URI of the library | 6536 * @return the result of resolving the URI against the URI of the library |
| 6516 */ | 6537 */ |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6803 unit.accept(typeResolverVisitor); | 6824 unit.accept(typeResolverVisitor); |
| 6804 InheritanceManager inheritanceManager = new InheritanceManager(_libraryEleme
nt); | 6825 InheritanceManager inheritanceManager = new InheritanceManager(_libraryEleme
nt); |
| 6805 ResolverVisitor resolverVisitor = new ResolverVisitor.con2(_libraryElement,
source, typeProvider, inheritanceManager, errorListener); | 6826 ResolverVisitor resolverVisitor = new ResolverVisitor.con2(_libraryElement,
source, typeProvider, inheritanceManager, errorListener); |
| 6806 unit.accept(resolverVisitor); | 6827 unit.accept(resolverVisitor); |
| 6807 for (ProxyConditionalAnalysisError conditionalCode in resolverVisitor.proxyC
onditionalAnalysisErrors) { | 6828 for (ProxyConditionalAnalysisError conditionalCode in resolverVisitor.proxyC
onditionalAnalysisErrors) { |
| 6808 if (conditionalCode.shouldIncludeErrorCode()) { | 6829 if (conditionalCode.shouldIncludeErrorCode()) { |
| 6809 resolverVisitor.reportError(conditionalCode.analysisError); | 6830 resolverVisitor.reportError(conditionalCode.analysisError); |
| 6810 } | 6831 } |
| 6811 } | 6832 } |
| 6812 TimeCounter_TimeCounterHandle counterHandleErrors = PerformanceStatistics.er
rors.start(); | 6833 TimeCounter_TimeCounterHandle counterHandleErrors = PerformanceStatistics.er
rors.start(); |
| 6813 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); | 6834 try { |
| 6814 ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, _libraryEleme
nt, typeProvider, inheritanceManager); | 6835 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); |
| 6815 unit.accept(errorVerifier); | 6836 ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, _libraryEle
ment, typeProvider, inheritanceManager); |
| 6816 ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, type
Provider); | 6837 unit.accept(errorVerifier); |
| 6817 unit.accept(constantVerifier); | 6838 ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, ty
peProvider); |
| 6818 counterHandleErrors.stop(); | 6839 unit.accept(constantVerifier); |
| 6840 } finally { |
| 6841 counterHandleErrors.stop(); |
| 6842 } |
| 6819 unit.resolutionErrors = errorListener.errors; | 6843 unit.resolutionErrors = errorListener.errors; |
| 6820 resolvedUnit = unit; | 6844 resolvedUnit = unit; |
| 6821 } | 6845 } |
| 6822 | 6846 |
| 6823 /** | 6847 /** |
| 6824 * Search the compilation units that are part of the given library and return
the element | 6848 * Search the compilation units that are part of the given library and return
the element |
| 6825 * representing the compilation unit with the given source. Return `null` if t
here is no | 6849 * representing the compilation unit with the given source. Return `null` if t
here is no |
| 6826 * such compilation unit. | 6850 * such compilation unit. |
| 6827 * | 6851 * |
| 6828 * @param libraryElement the element representing the library being searched t
hrough | 6852 * @param libraryElement the element representing the library being searched t
hrough |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6952 } | 6976 } |
| 6953 void logError2(String message, Exception exception) { | 6977 void logError2(String message, Exception exception) { |
| 6954 } | 6978 } |
| 6955 void logError3(Exception exception) { | 6979 void logError3(Exception exception) { |
| 6956 } | 6980 } |
| 6957 void logInformation(String message) { | 6981 void logInformation(String message) { |
| 6958 } | 6982 } |
| 6959 void logInformation2(String message, Exception exception) { | 6983 void logInformation2(String message, Exception exception) { |
| 6960 } | 6984 } |
| 6961 } | 6985 } |
| OLD | NEW |