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

Unified Diff: pkg/analyzer/bin/analyzer.dart

Issue 448913002: Analyzer: analyze plural files; remove unused async parameter (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/bin/analyzer.dart
diff --git a/pkg/analyzer/bin/analyzer.dart b/pkg/analyzer/bin/analyzer.dart
index db4c4752e4915f758f4268549f57d66ab886c9ad..016d04bc8035416227538e0f3588a3928676a9b8 100644
--- a/pkg/analyzer/bin/analyzer.dart
+++ b/pkg/analyzer/bin/analyzer.dart
@@ -7,7 +7,6 @@
/** The entry point for the analyzer. */
library analyzer;
-import 'dart:async';
import 'dart:convert';
import 'dart:io';
@@ -25,33 +24,41 @@ void main(args) {
if (options.shouldBatch) {
BatchRunner.runAsBatch(args, (List<String> args) {
CommandLineOptions options = CommandLineOptions.parse(args);
- return _runAnalyzer(options, false);
+ return _analyzeAll(options);
});
} else {
- _runAnalyzer(options, false);
+ _analyzeAll(options);
}
}
-_runAnalyzer(CommandLineOptions options, [bool async = true]) {
+_analyzeAll(CommandLineOptions options) {
if (!options.machineFormat) {
stdout.writeln("Analyzing ${options.sourceFiles}...");
}
ErrorSeverity allResult = ErrorSeverity.NONE;
- String sourcePath = options.sourceFiles[0];
- sourcePath = sourcePath.trim();
- // check that file exists
- if (!new File(sourcePath).existsSync()) {
- print('File not found: $sourcePath');
- exitCode = ErrorSeverity.ERROR.ordinal;
- return ErrorSeverity.ERROR;
+ for (String sourcePath in options.sourceFiles) {
+ sourcePath = sourcePath.trim();
+ // check that file exists
+ if (!new File(sourcePath).existsSync()) {
+ print('File not found: $sourcePath');
+ exitCode = ErrorSeverity.ERROR.ordinal;
+ // fail fast; don't analyze more files
+ return ErrorSeverity.ERROR;
+ }
+ // check that file is Dart file
+ if (!AnalysisEngine.isDartFileName(sourcePath)) {
+ print('$sourcePath is not a Dart file');
+ exitCode = ErrorSeverity.ERROR.ordinal;
+ // fail fast; don't analyze more files
+ return ErrorSeverity.ERROR;
+ }
+ ErrorSeverity status = _runAnalyzer(options, sourcePath);
+ allResult = allResult.max(status);
}
- // check that file is Dart file
- if (!AnalysisEngine.isDartFileName(sourcePath)) {
- print('$sourcePath is not a Dart file');
- exitCode = ErrorSeverity.ERROR.ordinal;
- return ErrorSeverity.ERROR;
- }
- // do analyze
+ return allResult;
+}
+
+_runAnalyzer(CommandLineOptions options, String sourcePath) {
if (options.warmPerf) {
int startTime = JavaSystem.currentTimeMillis();
AnalyzerImpl analyzer = new AnalyzerImpl(sourcePath, options, startTime);
@@ -70,18 +77,14 @@ _runAnalyzer(CommandLineOptions options, [bool async = true]) {
}
int startTime = JavaSystem.currentTimeMillis();
AnalyzerImpl analyzer = new AnalyzerImpl(sourcePath, options, startTime);
- if (async) {
- return analyzer.analyzeAsync();
- } else {
- var errorSeverity = analyzer.analyzeSync();
- if (errorSeverity == ErrorSeverity.ERROR) {
- exitCode = errorSeverity.ordinal;
- }
- if (options.warningsAreFatal && errorSeverity == ErrorSeverity.WARNING) {
- exitCode = errorSeverity.ordinal;
- }
- return errorSeverity;
+ var errorSeverity = analyzer.analyzeSync();
+ if (errorSeverity == ErrorSeverity.ERROR) {
+ exitCode = errorSeverity.ordinal;
}
+ if (options.warningsAreFatal && errorSeverity == ErrorSeverity.WARNING) {
+ exitCode = errorSeverity.ordinal;
+ }
+ return errorSeverity;
}
typedef ErrorSeverity BatchRunnerHandler(List<String> args);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698