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

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

Issue 944073003: Fix for filtering unknown options. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | pkg/analyzer/test/options_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/options.dart
diff --git a/pkg/analyzer/lib/options.dart b/pkg/analyzer/lib/options.dart
index 9d3b9d930f0c83e4d94687c526fd28a927c11286..ef7a677a1ea782ce7e49cf2369f6ca009917a8b9 100644
--- a/pkg/analyzer/lib/options.dart
+++ b/pkg/analyzer/lib/options.dart
@@ -396,7 +396,7 @@ class CommandLineParser {
return remainingArgs;
}
- List<String> _filterUnknowns(args) {
+ List<String> _filterUnknowns(List<String> args) {
// Only filter args if the ignore flag is specified, or if
// _alwaysIgnoreUnrecognized was set to true
@@ -409,11 +409,18 @@ class CommandLineParser {
// _knownFlags.contains(arg.substring(2)));
// Filter all unrecognized flags and options.
- var filtered = <String>[];
- for (var i = 0; i < args.length; ++i) {
- var arg = args[i];
+ List<String> filtered = <String>[];
+ for (int i = 0; i < args.length; ++i) {
+ String arg = args[i];
if (arg.startsWith('--') && arg.length > 2) {
- if (!_knownFlags.contains(arg.substring(2))) {
+ String option = arg.substring(2);
+ // strip the last '=value'
+ int equalsOffset = option.lastIndexOf('=');
+ if (equalsOffset != -1) {
+ option = option.substring(0, equalsOffset);
+ }
+ // check the option
+ if (!_knownFlags.contains(option)) {
//print('remove: $arg');
//"eat" params by advancing to the next flag/option
i = _getNextFlagIndex(args, i);
« no previous file with comments | « no previous file | pkg/analyzer/test/options_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698