| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
| 8 | 8 |
| 9 import 'package:analyzer/context/context_root.dart'; | 9 import 'package:analyzer/context/context_root.dart'; |
| 10 import 'package:analyzer/context/declared_variables.dart'; | 10 import 'package:analyzer/context/declared_variables.dart'; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 import 'package:analyzer/src/dart/analysis/library_context.dart'; | 23 import 'package:analyzer/src/dart/analysis/library_context.dart'; |
| 24 import 'package:analyzer/src/dart/analysis/search.dart'; | 24 import 'package:analyzer/src/dart/analysis/search.dart'; |
| 25 import 'package:analyzer/src/dart/analysis/status.dart'; | 25 import 'package:analyzer/src/dart/analysis/status.dart'; |
| 26 import 'package:analyzer/src/dart/analysis/top_level_declaration.dart'; | 26 import 'package:analyzer/src/dart/analysis/top_level_declaration.dart'; |
| 27 import 'package:analyzer/src/generated/engine.dart' | 27 import 'package:analyzer/src/generated/engine.dart' |
| 28 show AnalysisContext, AnalysisEngine, AnalysisOptions; | 28 show AnalysisContext, AnalysisEngine, AnalysisOptions; |
| 29 import 'package:analyzer/src/generated/source.dart'; | 29 import 'package:analyzer/src/generated/source.dart'; |
| 30 import 'package:analyzer/src/lint/registry.dart' as linter; | 30 import 'package:analyzer/src/lint/registry.dart' as linter; |
| 31 import 'package:analyzer/src/summary/api_signature.dart'; | 31 import 'package:analyzer/src/summary/api_signature.dart'; |
| 32 import 'package:analyzer/src/summary/format.dart'; | 32 import 'package:analyzer/src/summary/format.dart'; |
| 33 import 'package:front_end/src/base/instrumentation.dart' as fasta; |
| 33 import 'package:analyzer/src/summary/idl.dart'; | 34 import 'package:analyzer/src/summary/idl.dart'; |
| 34 import 'package:analyzer/src/summary/package_bundle_reader.dart'; | 35 import 'package:analyzer/src/summary/package_bundle_reader.dart'; |
| 35 import 'package:meta/meta.dart'; | 36 import 'package:meta/meta.dart'; |
| 36 | 37 |
| 37 /** | 38 /** |
| 38 * This class computes [AnalysisResult]s for Dart files. | 39 * This class computes [AnalysisResult]s for Dart files. |
| 39 * | 40 * |
| 40 * Let the set of "explicitly analyzed files" denote the set of paths that have | 41 * Let the set of "explicitly analyzed files" denote the set of paths that have |
| 41 * been passed to [addFile] but not subsequently passed to [removeFile]. Let | 42 * been passed to [addFile] but not subsequently passed to [removeFile]. Let |
| 42 * the "current analysis results" denote the map from the set of explicitly | 43 * the "current analysis results" denote the map from the set of explicitly |
| (...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 try { | 1014 try { |
| 1014 LibraryContext libraryContext = _createLibraryContext(library); | 1015 LibraryContext libraryContext = _createLibraryContext(library); |
| 1015 try { | 1016 try { |
| 1016 _testView.numOfAnalyzedLibraries++; | 1017 _testView.numOfAnalyzedLibraries++; |
| 1017 LibraryAnalyzer analyzer = new LibraryAnalyzer( | 1018 LibraryAnalyzer analyzer = new LibraryAnalyzer( |
| 1018 analysisOptions, | 1019 analysisOptions, |
| 1019 declaredVariables, | 1020 declaredVariables, |
| 1020 sourceFactory, | 1021 sourceFactory, |
| 1021 _fsState, | 1022 _fsState, |
| 1022 libraryContext.store, | 1023 libraryContext.store, |
| 1023 library); | 1024 library, |
| 1025 _testView.instrumentation); |
| 1024 Map<FileState, UnitAnalysisResult> results = analyzer.analyze(); | 1026 Map<FileState, UnitAnalysisResult> results = analyzer.analyze(); |
| 1025 | 1027 |
| 1026 List<int> bytes; | 1028 List<int> bytes; |
| 1027 CompilationUnit resolvedUnit; | 1029 CompilationUnit resolvedUnit; |
| 1028 for (FileState unitFile in results.keys) { | 1030 for (FileState unitFile in results.keys) { |
| 1029 UnitAnalysisResult unitResult = results[unitFile]; | 1031 UnitAnalysisResult unitResult = results[unitFile]; |
| 1030 List<int> unitBytes = | 1032 List<int> unitBytes = |
| 1031 _serializeResolvedUnit(unitResult.unit, unitResult.errors); | 1033 _serializeResolvedUnit(unitResult.unit, unitResult.errors); |
| 1032 String unitSignature = _getResolvedUnitSignature(library, unitFile); | 1034 String unitSignature = _getResolvedUnitSignature(library, unitFile); |
| 1033 String unitKey = _getResolvedUnitKey(unitSignature); | 1035 String unitKey = _getResolvedUnitKey(unitSignature); |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1556 } | 1558 } |
| 1557 | 1559 |
| 1558 @visibleForTesting | 1560 @visibleForTesting |
| 1559 class AnalysisDriverTestView { | 1561 class AnalysisDriverTestView { |
| 1560 final AnalysisDriver driver; | 1562 final AnalysisDriver driver; |
| 1561 | 1563 |
| 1562 int numOfCreatedLibraryContexts = 0; | 1564 int numOfCreatedLibraryContexts = 0; |
| 1563 | 1565 |
| 1564 int numOfAnalyzedLibraries = 0; | 1566 int numOfAnalyzedLibraries = 0; |
| 1565 | 1567 |
| 1568 fasta.Instrumentation instrumentation; |
| 1569 |
| 1566 AnalysisDriverTestView(this.driver); | 1570 AnalysisDriverTestView(this.driver); |
| 1567 | 1571 |
| 1568 FileTracker get fileTracker => driver._fileTracker; | 1572 FileTracker get fileTracker => driver._fileTracker; |
| 1569 | 1573 |
| 1570 Map<String, AnalysisResult> get priorityResults => driver._priorityResults; | 1574 Map<String, AnalysisResult> get priorityResults => driver._priorityResults; |
| 1571 | 1575 |
| 1572 SummaryDataStore getSummaryStore(String libraryPath) { | 1576 SummaryDataStore getSummaryStore(String libraryPath) { |
| 1573 FileState library = driver.fsState.getFileForPath(libraryPath); | 1577 FileState library = driver.fsState.getFileForPath(libraryPath); |
| 1574 LibraryContext libraryContext = driver._createLibraryContext(library); | 1578 LibraryContext libraryContext = driver._createLibraryContext(library); |
| 1575 try { | 1579 try { |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2101 libraryDeclarations.add(new TopLevelDeclarationInSource( | 2105 libraryDeclarations.add(new TopLevelDeclarationInSource( |
| 2102 file.source, declaration, isExported)); | 2106 file.source, declaration, isExported)); |
| 2103 } | 2107 } |
| 2104 } | 2108 } |
| 2105 } | 2109 } |
| 2106 | 2110 |
| 2107 // We're not done yet. | 2111 // We're not done yet. |
| 2108 return false; | 2112 return false; |
| 2109 } | 2113 } |
| 2110 } | 2114 } |
| OLD | NEW |