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

Unified Diff: pkg/compiler/lib/src/apiimpl.dart

Issue 1513263002: Support optional package name arguments to --show-package-warnings (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments Created 5 years 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/compiler/lib/src/commandline_options.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/apiimpl.dart
diff --git a/pkg/compiler/lib/src/apiimpl.dart b/pkg/compiler/lib/src/apiimpl.dart
index 556006a2172a4ac9765a2f35159fd10e3976f0db..6c469a4c3fd05d6a6a0cc157d07028573a2f7aa7 100644
--- a/pkg/compiler/lib/src/apiimpl.dart
+++ b/pkg/compiler/lib/src/apiimpl.dart
@@ -124,8 +124,8 @@ class CompilerImpl extends Compiler {
fatalWarnings: hasOption(options, Flags.fatalWarnings),
suppressHints: hasOption(options, Flags.suppressHints),
terseDiagnostics: hasOption(options, Flags.terse),
- showPackageWarnings:
- hasOption(options, Flags.showPackageWarnings)),
+ shownPackageWarnings: extractOptionalCsvOption(
+ options, Flags.showPackageWarnings)),
enableExperimentalMirrors:
hasOption(options, Flags.enableExperimentalMirrors),
enableAssertMessage:
@@ -189,6 +189,23 @@ class CompilerImpl extends Compiler {
return const <String>[];
}
+ /// Extract list of comma separated values provided for [flag]. Returns an
+ /// empty list if [option] contain [flag] without arguments. Returns `null` if
+ /// [option] doesn't contain [flag] with or without arguments.
+ static List<String> extractOptionalCsvOption(
+ List<String> options, String flag) {
+ String prefix = '$flag=';
+ for (String option in options) {
+ if (option == flag) {
+ return const <String>[];
+ }
+ if (option.startsWith(flag)) {
+ return option.substring(prefix.length).split(',');
+ }
+ }
+ return null;
+ }
+
static Uri resolvePlatformConfig(Uri libraryRoot,
List<String> options) {
String platformConfigPath =
« no previous file with comments | « no previous file | pkg/compiler/lib/src/commandline_options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698