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

Unified Diff: dart/site/try/poi/poi.dart

Issue 551383002: Add --enable-dart-mind option to poi.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update test to use new variable name. Created 6 years, 3 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 | dart/tests/try/poi/poi_test.dart » ('j') | dart/tests/try/poi/poi_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/site/try/poi/poi.dart
diff --git a/dart/site/try/poi/poi.dart b/dart/site/try/poi/poi.dart
index 5ae34dcec69ed9654e4c9c5edb82f6138ebbb105..5b80277d7235c81f54379b0ceba17dcadfdd412c 100644
--- a/dart/site/try/poi/poi.dart
+++ b/dart/site/try/poi/poi.dart
@@ -64,8 +64,9 @@ import 'package:compiler/implementation/scanner/scannerlib.dart' show
PartialElement,
Token;
-/// Controls if this program should be querying Dart Mind. Used by tests.
-bool enableDartMind = true;
+/// Enabled by the option --enable-dart-mind. Controls if this program should
+/// be querying Dart Mind.
+bool isDartMindEnabled = false;
/// Iterator over lines from standard input (or the argument array).
Iterator<String> stdin;
@@ -121,6 +122,9 @@ main(List<String> arguments) {
case '--simulate-mutation':
isSimulateMutationEnabled = true;
break;
+ case '--enable-dart-mind':
+ isDartMindEnabled = true;
+ break;
case '-v':
case '--verbose':
isVerbose = true;
@@ -202,7 +206,6 @@ Future<String> prompt(message) {
Future queryDartMind(String prefix, String info) {
// TODO(lukechurch): Use [info] for something.
- if (!enableDartMind) return new Future.value("[]");
String encodedArg0 = Uri.encodeComponent('"$prefix"');
String mindQuery =
'http://dart-mind.appspot.com/rpc'
@@ -273,9 +276,10 @@ Future parseUserInput(
prefix = token.value.substring(0, position - token.charOffset);
}
}
+ sw.stop();
printVerbose('Find token took ${sw.elapsedMicroseconds}us.');
- sw.reset();
- if (prefix != null) {
+ if (isDartMindEnabled && prefix != null) {
+ sw..reset()..start();
return queryDartMind(prefix, info).then((String dartMindSuggestion) {
sw.stop();
print('Dart Mind ($prefix): $dartMindSuggestion.');
@@ -283,7 +287,9 @@ Future parseUserInput(
return repeat();
});
} else {
- print("Didn't talk to Dart Mind, no identifier at POI ($token).");
+ if (isDartMindEnabled) {
+ print("Didn't talk to Dart Mind, no identifier at POI ($token).");
+ }
return repeat();
}
});
« no previous file with comments | « no previous file | dart/tests/try/poi/poi_test.dart » ('j') | dart/tests/try/poi/poi_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698