| 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 library engine; | 5 library engine; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:math' as math; | 9 import 'dart:math' as math; |
| 10 | 10 |
| (...skipping 8472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8483 @override | 8483 @override |
| 8484 accept(AnalysisTaskVisitor visitor) => | 8484 accept(AnalysisTaskVisitor visitor) => |
| 8485 visitor.visitGenerateDartErrorsTask(this); | 8485 visitor.visitGenerateDartErrorsTask(this); |
| 8486 | 8486 |
| 8487 @override | 8487 @override |
| 8488 void internalPerform() { | 8488 void internalPerform() { |
| 8489 PerformanceStatistics.errors.makeCurrentWhile(() { | 8489 PerformanceStatistics.errors.makeCurrentWhile(() { |
| 8490 RecordingErrorListener errorListener = new RecordingErrorListener(); | 8490 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 8491 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); | 8491 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); |
| 8492 TypeProvider typeProvider = context.typeProvider; | 8492 TypeProvider typeProvider = context.typeProvider; |
| 8493 TypeSystem typeSystem = context.typeSystem; | |
| 8494 // | 8493 // |
| 8495 // Validate the directives | 8494 // Validate the directives |
| 8496 // | 8495 // |
| 8497 validateDirectives(context, source, _unit, errorListener); | 8496 validateDirectives(context, source, _unit, errorListener); |
| 8498 // | 8497 // |
| 8499 // Use the ConstantVerifier to verify the use of constants. | 8498 // Use the ConstantVerifier to verify the use of constants. |
| 8500 // This needs to happen before using the ErrorVerifier because some error | 8499 // This needs to happen before using the ErrorVerifier because some error |
| 8501 // codes need the computed constant values. | 8500 // codes need the computed constant values. |
| 8502 // | 8501 // |
| 8503 // TODO(paulberry): as a temporary workaround for issue 21572, | 8502 // TODO(paulberry): as a temporary workaround for issue 21572, |
| 8504 // ConstantVerifier is being run right after ConstantValueComputer, so we | 8503 // ConstantVerifier is being run right after ConstantValueComputer, so we |
| 8505 // don't need to run it here. Once issue 21572 is fixed, re-enable the | 8504 // don't need to run it here. Once issue 21572 is fixed, re-enable the |
| 8506 // call to ConstantVerifier. | 8505 // call to ConstantVerifier. |
| 8507 // ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter,
libraryElement, typeProvider); | 8506 // ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter,
libraryElement, typeProvider); |
| 8508 // _unit.accept(constantVerifier); | 8507 // _unit.accept(constantVerifier); |
| 8509 // | 8508 // |
| 8510 // Use the ErrorVerifier to compute the rest of the errors. | 8509 // Use the ErrorVerifier to compute the rest of the errors. |
| 8511 // | 8510 // |
| 8512 ErrorVerifier errorVerifier = new ErrorVerifier( | 8511 ErrorVerifier errorVerifier = new ErrorVerifier( |
| 8513 errorReporter, | 8512 errorReporter, |
| 8514 libraryElement, | 8513 libraryElement, |
| 8515 typeProvider, | 8514 typeProvider, |
| 8516 typeSystem, | |
| 8517 new InheritanceManager(libraryElement), | 8515 new InheritanceManager(libraryElement), |
| 8518 context.analysisOptions.enableSuperMixins); | 8516 context.analysisOptions.enableSuperMixins); |
| 8519 _unit.accept(errorVerifier); | 8517 _unit.accept(errorVerifier); |
| 8520 _errors = errorListener.getErrorsForSource(source); | 8518 _errors = errorListener.getErrorsForSource(source); |
| 8521 }); | 8519 }); |
| 8522 } | 8520 } |
| 8523 | 8521 |
| 8524 /** | 8522 /** |
| 8525 * Check each directive in the given compilation unit to see if the referenced
source exists and | 8523 * Check each directive in the given compilation unit to see if the referenced
source exists and |
| 8526 * report an error if it does not. | 8524 * report an error if it does not. |
| (...skipping 2416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10943 } | 10941 } |
| 10944 return "resolve unit ${librarySource.fullName}"; | 10942 return "resolve unit ${librarySource.fullName}"; |
| 10945 } | 10943 } |
| 10946 | 10944 |
| 10947 @override | 10945 @override |
| 10948 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartUnitTask(this); | 10946 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartUnitTask(this); |
| 10949 | 10947 |
| 10950 @override | 10948 @override |
| 10951 void internalPerform() { | 10949 void internalPerform() { |
| 10952 TypeProvider typeProvider = _libraryElement.context.typeProvider; | 10950 TypeProvider typeProvider = _libraryElement.context.typeProvider; |
| 10953 TypeSystem typeSystem = _libraryElement.context.typeSystem; | |
| 10954 CompilationUnit unit = context.computeResolvableCompilationUnit(source); | 10951 CompilationUnit unit = context.computeResolvableCompilationUnit(source); |
| 10955 if (unit == null) { | 10952 if (unit == null) { |
| 10956 throw new AnalysisException( | 10953 throw new AnalysisException( |
| 10957 "Internal error: computeResolvableCompilationUnit returned a value wit
hout a parsed Dart unit"); | 10954 "Internal error: computeResolvableCompilationUnit returned a value wit
hout a parsed Dart unit"); |
| 10958 } | 10955 } |
| 10959 // | 10956 // |
| 10960 // Resolve names in declarations. | 10957 // Resolve names in declarations. |
| 10961 // | 10958 // |
| 10962 new DeclarationResolver().resolve(unit, _find(_libraryElement, source)); | 10959 new DeclarationResolver().resolve(unit, _find(_libraryElement, source)); |
| 10963 // | 10960 // |
| 10964 // Resolve the type names. | 10961 // Resolve the type names. |
| 10965 // | 10962 // |
| 10966 RecordingErrorListener errorListener = new RecordingErrorListener(); | 10963 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 10967 TypeResolverVisitor typeResolverVisitor = new TypeResolverVisitor( | 10964 TypeResolverVisitor typeResolverVisitor = new TypeResolverVisitor( |
| 10968 _libraryElement, source, typeProvider, errorListener); | 10965 _libraryElement, source, typeProvider, errorListener); |
| 10969 unit.accept(typeResolverVisitor); | 10966 unit.accept(typeResolverVisitor); |
| 10970 // | 10967 // |
| 10971 // Resolve the rest of the structure | 10968 // Resolve the rest of the structure |
| 10972 // | 10969 // |
| 10973 InheritanceManager inheritanceManager = | 10970 InheritanceManager inheritanceManager = |
| 10974 new InheritanceManager(_libraryElement); | 10971 new InheritanceManager(_libraryElement); |
| 10975 ResolverVisitor resolverVisitor = new ResolverVisitor( | 10972 ResolverVisitor resolverVisitor = new ResolverVisitor( |
| 10976 _libraryElement, source, typeProvider, typeSystem, errorListener, | 10973 _libraryElement, source, typeProvider, errorListener, |
| 10977 inheritanceManager: inheritanceManager); | 10974 inheritanceManager: inheritanceManager); |
| 10978 unit.accept(resolverVisitor); | 10975 unit.accept(resolverVisitor); |
| 10979 // | 10976 // |
| 10980 // Perform additional error checking. | 10977 // Perform additional error checking. |
| 10981 // | 10978 // |
| 10982 PerformanceStatistics.errors.makeCurrentWhile(() { | 10979 PerformanceStatistics.errors.makeCurrentWhile(() { |
| 10983 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); | 10980 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); |
| 10984 ErrorVerifier errorVerifier = new ErrorVerifier( | 10981 ErrorVerifier errorVerifier = new ErrorVerifier( |
| 10985 errorReporter, | 10982 errorReporter, |
| 10986 _libraryElement, | 10983 _libraryElement, |
| 10987 typeProvider, | 10984 typeProvider, |
| 10988 typeSystem, | |
| 10989 inheritanceManager, | 10985 inheritanceManager, |
| 10990 context.analysisOptions.enableSuperMixins); | 10986 context.analysisOptions.enableSuperMixins); |
| 10991 unit.accept(errorVerifier); | 10987 unit.accept(errorVerifier); |
| 10992 // TODO(paulberry): as a temporary workaround for issue 21572, | 10988 // TODO(paulberry): as a temporary workaround for issue 21572, |
| 10993 // ConstantVerifier is being run right after ConstantValueComputer, so we | 10989 // ConstantVerifier is being run right after ConstantValueComputer, so we |
| 10994 // don't need to run it here. Once issue 21572 is fixed, re-enable the | 10990 // don't need to run it here. Once issue 21572 is fixed, re-enable the |
| 10995 // call to ConstantVerifier. | 10991 // call to ConstantVerifier. |
| 10996 // ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter,
_libraryElement, typeProvider); | 10992 // ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter,
_libraryElement, typeProvider); |
| 10997 // unit.accept(constantVerifier); | 10993 // unit.accept(constantVerifier); |
| 10998 }); | 10994 }); |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12074 PendingFuture pendingFuture = | 12070 PendingFuture pendingFuture = |
| 12075 new PendingFuture<T>(_context, source, computeValue); | 12071 new PendingFuture<T>(_context, source, computeValue); |
| 12076 if (!pendingFuture.evaluate(sourceEntry)) { | 12072 if (!pendingFuture.evaluate(sourceEntry)) { |
| 12077 _context._pendingFutureSources | 12073 _context._pendingFutureSources |
| 12078 .putIfAbsent(source, () => <PendingFuture>[]) | 12074 .putIfAbsent(source, () => <PendingFuture>[]) |
| 12079 .add(pendingFuture); | 12075 .add(pendingFuture); |
| 12080 } | 12076 } |
| 12081 return pendingFuture.future; | 12077 return pendingFuture.future; |
| 12082 } | 12078 } |
| 12083 } | 12079 } |
| OLD | NEW |