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

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

Issue 19810004: pkg/args: expose immutable collections (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: trying again Created 7 years, 5 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/args/lib/args.dart ('k') | pkg/args/lib/src/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/args/lib/src/options.dart
diff --git a/pkg/args/lib/src/options.dart b/pkg/args/lib/src/options.dart
index 00c0ad8dc22b2f190b418b6436846cc054a4c139..5f1f48405ce04c627881789875c71c731cd641ff 100644
--- a/pkg/args/lib/src/options.dart
+++ b/pkg/args/lib/src/options.dart
@@ -1,5 +1,7 @@
library options;
+import 'package:unmodifiable_collection/unmodifiable_collection.dart';
+
/**
* A command-line option. Includes both flags and options which take a value.
*/
@@ -15,9 +17,13 @@ class Option {
final bool negatable;
final bool allowMultiple;
- Option(this.name, this.abbreviation, this.help, this.allowed,
- this.allowedHelp, this.defaultValue, this.callback, {this.isFlag,
- this.negatable, this.allowMultiple: false}) {
+ Option(this.name, this.abbreviation, this.help, List<String> allowed,
+ Map<String, String> allowedHelp, this.defaultValue, this.callback,
+ {this.isFlag, this.negatable, this.allowMultiple: false}) :
+ this.allowed = allowed == null ?
+ null : new UnmodifiableListView(allowed),
+ this.allowedHelp = allowedHelp == null ?
+ null : new UnmodifiableMapView(allowedHelp) {
if (name.isEmpty) {
throw new ArgumentError('Name cannot be empty.');
« no previous file with comments | « pkg/args/lib/args.dart ('k') | pkg/args/lib/src/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698