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

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

Issue 2917183003: update the analyzer and analysis server perf tags (Closed)
Patch Set: updates for review comments Created 3 years, 6 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
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 'package:analyzer/context/declared_variables.dart'; 5 import 'package:analyzer/context/declared_variables.dart';
6 import 'package:analyzer/dart/ast/ast.dart'; 6 import 'package:analyzer/dart/ast/ast.dart';
7 import 'package:analyzer/dart/ast/visitor.dart'; 7 import 'package:analyzer/dart/ast/visitor.dart';
8 import 'package:analyzer/dart/element/element.dart'; 8 import 'package:analyzer/dart/element/element.dart';
9 import 'package:analyzer/error/error.dart'; 9 import 'package:analyzer/error/error.dart';
10 import 'package:analyzer/error/listener.dart'; 10 import 'package:analyzer/error/listener.dart';
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 final Map<FileState, List<PendingError>> _fileToPendingErrors = {}; 53 final Map<FileState, List<PendingError>> _fileToPendingErrors = {};
54 final List<ConstantEvaluationTarget> _constants = []; 54 final List<ConstantEvaluationTarget> _constants = [];
55 55
56 LibraryAnalyzer(this._analysisOptions, this._declaredVariables, 56 LibraryAnalyzer(this._analysisOptions, this._declaredVariables,
57 this._sourceFactory, this._fsState, this._store, this._library); 57 this._sourceFactory, this._fsState, this._store, this._library);
58 58
59 /** 59 /**
60 * Compute analysis results for all units of the library. 60 * Compute analysis results for all units of the library.
61 */ 61 */
62 Map<FileState, UnitAnalysisResult> analyze() { 62 Map<FileState, UnitAnalysisResult> analyze() {
63 return PerformanceStatistics.analysis.makeCurrentWhile(() {
64 return _analyze();
65 });
66 }
67
68 Map<FileState, UnitAnalysisResult> _analyze() {
63 Map<FileState, CompilationUnit> units = {}; 69 Map<FileState, CompilationUnit> units = {};
64 70
65 // Parse all files. 71 // Parse all files.
66 units[_library] = _parse(_library); 72 units[_library] = _parse(_library);
67 for (FileState part in _library.partedFiles) { 73 for (FileState part in _library.partedFiles) {
68 units[part] = _parse(part); 74 units[part] = _parse(part);
69 } 75 }
70 76
71 // Resolve URIs in directives to corresponding sources. 77 // Resolve URIs in directives to corresponding sources.
72 units.forEach((file, unit) { 78 units.forEach((file, unit) {
(...skipping 12 matching lines...) Expand all
85 91
86 _resolveDirectives(units); 92 _resolveDirectives(units);
87 93
88 units.forEach((file, unit) { 94 units.forEach((file, unit) {
89 _resolveFile(file, unit); 95 _resolveFile(file, unit);
90 _computePendingMissingRequiredParameters(file, unit); 96 _computePendingMissingRequiredParameters(file, unit);
91 }); 97 });
92 98
93 _computeConstants(); 99 _computeConstants();
94 100
95 units.forEach((file, unit) { 101 PerformanceStatistics.errors.makeCurrentWhile(() {
96 _computeVerifyErrors(file, unit); 102 units.forEach((file, unit) {
103 _computeVerifyErrors(file, unit);
104 });
97 }); 105 });
98 106
99 if (_analysisOptions.hint) { 107 if (_analysisOptions.hint) {
100 units.forEach((file, unit) { 108 PerformanceStatistics.hints.makeCurrentWhile(() {
101 { 109 units.forEach((file, unit) {
102 var visitor = new GatherUsedLocalElementsVisitor(_libraryElement); 110 {
103 unit.accept(visitor); 111 var visitor = new GatherUsedLocalElementsVisitor(_libraryElement);
104 _usedLocalElementsList.add(visitor.usedElements); 112 unit.accept(visitor);
105 } 113 _usedLocalElementsList.add(visitor.usedElements);
106 { 114 }
107 var visitor = 115 {
108 new GatherUsedImportedElementsVisitor(_libraryElement); 116 var visitor =
109 unit.accept(visitor); 117 new GatherUsedImportedElementsVisitor(_libraryElement);
110 _usedImportedElementsList.add(visitor.usedElements); 118 unit.accept(visitor);
111 } 119 _usedImportedElementsList.add(visitor.usedElements);
112 }); 120 }
113 units.forEach((file, unit) { 121 });
114 _computeHints(file, unit); 122 units.forEach((file, unit) {
123 _computeHints(file, unit);
124 });
115 }); 125 });
116 } 126 }
117 127
118 if (_analysisOptions.lint) { 128 if (_analysisOptions.lint) {
119 units.forEach((file, unit) { 129 PerformanceStatistics.lints.makeCurrentWhile(() {
120 _computeLints(file, unit); 130 units.forEach((file, unit) {
131 _computeLints(file, unit);
132 });
121 }); 133 });
122 } 134 }
123 } finally { 135 } finally {
124 _context.dispose(); 136 _context.dispose();
125 } 137 }
126 138
127 // Return full results. 139 // Return full results.
128 Map<FileState, UnitAnalysisResult> results = {}; 140 Map<FileState, UnitAnalysisResult> results = {};
129 units.forEach((file, unit) { 141 units.forEach((file, unit) {
130 List<AnalysisError> errors = _getErrorListener(file).errors; 142 List<AnalysisError> errors = _getErrorListener(file).errors;
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 } 796 }
785 797
786 /** 798 /**
787 * Either the name or the source associated with a part-of directive. 799 * Either the name or the source associated with a part-of directive.
788 */ 800 */
789 class _NameOrSource { 801 class _NameOrSource {
790 final String name; 802 final String name;
791 final Source source; 803 final Source source;
792 _NameOrSource(this.name, this.source); 804 _NameOrSource(this.name, this.source);
793 } 805 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698