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

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

Issue 12092002: Library skew fix (in quest for build greeness) [TBR]. (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 | « 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-experimental/lib/options.dart
===================================================================
--- pkg/analyzer-experimental/lib/options.dart (revision 17669)
+++ pkg/analyzer-experimental/lib/options.dart (working copy)
@@ -114,6 +114,7 @@
: _knownFlags = <String>[],
_parser = new ArgParser();
+
/**
* Defines a flag.
*
@@ -139,6 +140,7 @@
allowMultiple: allowMultiple);
}
+
/**
* Generates a string displaying usage information for the defined options.
*
@@ -161,11 +163,37 @@
return args;
}
+ //TODO(pquitslund): replace w/ the following once library skew issues are sorted out
+ //return args.where((arg) => !arg.startsWith('--') ||
+ // _knownFlags.contains(arg.substring(2)));
+
// Filter all unrecognized flags and options.
- return args.where((arg) => !arg.startsWith('--') ||
- _knownFlags.contains(arg.substring(2)));
+ 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 filtered;
}
+ _getNextFlagIndex(args, i) {
+ for ( ; i < args.length; ++i) {
+ if (args[i].startsWith('--')) {
+ return i;
+ }
+ }
+ return i;
+ }
+
}
« 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