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

Unified Diff: pkg/analyzer_cli/lib/src/options.dart

Issue 2733953005: Correct --persistent_worker arg constraint check (Closed)
Patch Set: Created 3 years, 9 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_cli/lib/src/options.dart
diff --git a/pkg/analyzer_cli/lib/src/options.dart b/pkg/analyzer_cli/lib/src/options.dart
index aab9ddf32158c3dbfb789cf71cbd6abee5bc21cd..0dfbde4941ac5c7fb65a47ba3fd79df684b6dc09 100644
--- a/pkg/analyzer_cli/lib/src/options.dart
+++ b/pkg/analyzer_cli/lib/src/options.dart
@@ -456,17 +456,11 @@ class CommandLineOptions {
// Persistent worker.
if (args.contains('--persistent_worker')) {
- bool validArgs;
- if (!args.contains('--build-mode')) {
- validArgs = false;
- } else if (args.length == 2) {
- validArgs = true;
- } else if (args.length == 4 && args.contains('--dart-sdk')) {
- validArgs = true;
- } else {
- validArgs = false;
- }
- if (!validArgs) {
+ bool hasBuildMode = args.contains('--build-mode');
+ bool onlyDartSdkArg = args.length == 2 ||
+ (args.length == 3 && args.any((a) => a.startsWith('--dart-sdk'))) ||
+ (args.length == 4 && args.contains('--dart-sdk'));
+ if (!(hasBuildMode && onlyDartSdkArg)) {
printAndFail('The --persistent_worker flag should be used with and '
'only with the --build-mode flag, and possibly the --dart-sdk '
'option. Got: $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