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

Unified Diff: pkg/analyzer-experimental/lib/options.dart

Issue 12049028: Options parsing cleanup. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 | « pkg/analyzer-experimental/bin/analyzer.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer-experimental/lib/options.dart
===================================================================
--- pkg/analyzer-experimental/lib/options.dart (revision 17426)
+++ pkg/analyzer-experimental/lib/options.dart (working copy)
@@ -114,7 +114,6 @@
: _knownFlags = <String>[],
_parser = new ArgParser();
-
/**
* Defines a flag.
*
@@ -140,7 +139,6 @@
allowMultiple: allowMultiple);
}
-
/**
* Generates a string displaying usage information for the defined options.
*
@@ -164,32 +162,10 @@
}
// Filter all unrecognized flags and options.
- var filtered = <String>[];
- for (var i=0; i < args.length; ++i) {
- var arg = args[i];
- if (arg.startsWith('--') && arg.length > 2) {
- if (!_knownFlags.contains(arg.substring(2))) {
- //"eat" params by advancing to the next flag/option
- i = _getNextFlagIndex(args, i);
- } else {
- filtered.add(arg);
- }
- } else {
- filtered.add(arg);
- }
- }
+ return args.where((arg) => !arg.startsWith('--') ||
+ _knownFlags.contains(arg.substring(2)));
- return filtered;
}
- _getNextFlagIndex(args, i) {
- for ( ; i < args.length; ++i) {
- if (args[i].startsWith('--')) {
- return i;
- }
- }
- return i;
- }
-
}
« no previous file with comments | « pkg/analyzer-experimental/bin/analyzer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698