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

Side by Side Diff: pkg/analysis_server/lib/src/server_options.dart

Issue 1253183015: Flip .packages server support bit. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analysis_server.src.server_options; 5 library analysis_server.src.server_options;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:path/path.dart' as path; 10 import 'package:path/path.dart' as path;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 /// Get a String value for this `key` or [defaultValue] if undefined 82 /// Get a String value for this `key` or [defaultValue] if undefined
83 /// or not a String. 83 /// or not a String.
84 String getStringValue(String key, {String defaultValue: null}) { 84 String getStringValue(String key, {String defaultValue: null}) {
85 var value = _options[key]; 85 var value = _options[key];
86 if (value is String) { 86 if (value is String) {
87 return value; 87 return value;
88 } 88 }
89 return defaultValue; 89 return defaultValue;
90 } 90 }
91 91
92 /// Test whether the given [booleanPropertyKey] is set to the value `true`. 92 /// Test whether the given [booleanPropertyKey] is set to the value `true`,
93 /// falling back to [defaultValue] if undefined.
93 /// For example: 94 /// For example:
94 /// myDebugOption1:true 95 /// myDebugOption1:true
95 /// myDebugOption2:TRUE # Also true (case and trailing whitespace are igno red). 96 /// myDebugOption2:TRUE # Also true (case and trailing whitespace are igno red).
96 /// myDebugOption3:false 97 /// myDebugOption3:false
97 /// myDebugOption4:off # Treated as `false`. 98 /// myDebugOption4:off # Treated as `false`.
98 /// myDebugOption5:on # Also read as `false`. 99 /// myDebugOption5:on # Also read as `false`.
99 bool isSet(String booleanPropertyKey) => _options[booleanPropertyKey] == true; 100 bool isSet(String booleanPropertyKey, {bool defaultValue: false}) {
101 var value = _options[booleanPropertyKey];
102 if (value == null) {
103 return defaultValue;
104 }
105 return value == true;
106 }
100 107
101 void _readOptions(String contents) { 108 void _readOptions(String contents) {
102 var doc = loadYaml(contents); 109 var doc = loadYaml(contents);
103 if (doc is YamlMap) { 110 if (doc is YamlMap) {
104 doc.forEach((k, v) { 111 doc.forEach((k, v) {
105 if (k is String) { 112 if (k is String) {
106 _options[k] = v; 113 _options[k] = v;
107 } 114 }
108 }); 115 });
109 } 116 }
110 } 117 }
111 } 118 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | pkg/analysis_server/test/server_options_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698