Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Side by Side Diff: pkg/analyzer/lib/src/dart/analysis/driver.dart

Issue 2846883005: Rollback instrumentation during analysis and validate resolved ASTs instead. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer/analyzer.iml ('k') | pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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;
34 import 'package:analyzer/src/summary/idl.dart'; 33 import 'package:analyzer/src/summary/idl.dart';
35 import 'package:analyzer/src/summary/package_bundle_reader.dart'; 34 import 'package:analyzer/src/summary/package_bundle_reader.dart';
36 import 'package:meta/meta.dart'; 35 import 'package:meta/meta.dart';
37 36
38 /** 37 /**
39 * This class computes [AnalysisResult]s for Dart files. 38 * This class computes [AnalysisResult]s for Dart files.
40 * 39 *
41 * Let the set of "explicitly analyzed files" denote the set of paths that have 40 * Let the set of "explicitly analyzed files" denote the set of paths that have
42 * been passed to [addFile] but not subsequently passed to [removeFile]. Let 41 * been passed to [addFile] but not subsequently passed to [removeFile]. Let
43 * the "current analysis results" denote the map from the set of explicitly 42 * the "current analysis results" denote the map from the set of explicitly
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 try { 1013 try {
1015 LibraryContext libraryContext = _createLibraryContext(library); 1014 LibraryContext libraryContext = _createLibraryContext(library);
1016 try { 1015 try {
1017 _testView.numOfAnalyzedLibraries++; 1016 _testView.numOfAnalyzedLibraries++;
1018 LibraryAnalyzer analyzer = new LibraryAnalyzer( 1017 LibraryAnalyzer analyzer = new LibraryAnalyzer(
1019 analysisOptions, 1018 analysisOptions,
1020 declaredVariables, 1019 declaredVariables,
1021 sourceFactory, 1020 sourceFactory,
1022 _fsState, 1021 _fsState,
1023 libraryContext.store, 1022 libraryContext.store,
1024 library, 1023 library);
1025 _testView.instrumentation);
1026 Map<FileState, UnitAnalysisResult> results = analyzer.analyze(); 1024 Map<FileState, UnitAnalysisResult> results = analyzer.analyze();
1027 1025
1028 List<int> bytes; 1026 List<int> bytes;
1029 CompilationUnit resolvedUnit; 1027 CompilationUnit resolvedUnit;
1030 for (FileState unitFile in results.keys) { 1028 for (FileState unitFile in results.keys) {
1031 UnitAnalysisResult unitResult = results[unitFile]; 1029 UnitAnalysisResult unitResult = results[unitFile];
1032 List<int> unitBytes = 1030 List<int> unitBytes =
1033 _serializeResolvedUnit(unitResult.unit, unitResult.errors); 1031 _serializeResolvedUnit(unitResult.unit, unitResult.errors);
1034 String unitSignature = _getResolvedUnitSignature(library, unitFile); 1032 String unitSignature = _getResolvedUnitSignature(library, unitFile);
1035 String unitKey = _getResolvedUnitKey(unitSignature); 1033 String unitKey = _getResolvedUnitKey(unitSignature);
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 } 1556 }
1559 1557
1560 @visibleForTesting 1558 @visibleForTesting
1561 class AnalysisDriverTestView { 1559 class AnalysisDriverTestView {
1562 final AnalysisDriver driver; 1560 final AnalysisDriver driver;
1563 1561
1564 int numOfCreatedLibraryContexts = 0; 1562 int numOfCreatedLibraryContexts = 0;
1565 1563
1566 int numOfAnalyzedLibraries = 0; 1564 int numOfAnalyzedLibraries = 0;
1567 1565
1568 fasta.Instrumentation instrumentation;
1569
1570 AnalysisDriverTestView(this.driver); 1566 AnalysisDriverTestView(this.driver);
1571 1567
1572 FileTracker get fileTracker => driver._fileTracker; 1568 FileTracker get fileTracker => driver._fileTracker;
1573 1569
1574 Map<String, AnalysisResult> get priorityResults => driver._priorityResults; 1570 Map<String, AnalysisResult> get priorityResults => driver._priorityResults;
1575 1571
1576 SummaryDataStore getSummaryStore(String libraryPath) { 1572 SummaryDataStore getSummaryStore(String libraryPath) {
1577 FileState library = driver.fsState.getFileForPath(libraryPath); 1573 FileState library = driver.fsState.getFileForPath(libraryPath);
1578 LibraryContext libraryContext = driver._createLibraryContext(library); 1574 LibraryContext libraryContext = driver._createLibraryContext(library);
1579 try { 1575 try {
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
2105 libraryDeclarations.add(new TopLevelDeclarationInSource( 2101 libraryDeclarations.add(new TopLevelDeclarationInSource(
2106 file.source, declaration, isExported)); 2102 file.source, declaration, isExported));
2107 } 2103 }
2108 } 2104 }
2109 } 2105 }
2110 2106
2111 // We're not done yet. 2107 // We're not done yet.
2112 return false; 2108 return false;
2113 } 2109 }
2114 } 2110 }
OLDNEW
« no previous file with comments | « pkg/analyzer/analyzer.iml ('k') | pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698