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

Unified Diff: pkg/intl/test/data_directory.dart

Issue 13898014: Allow suppressing message extraction warnings, providing a prefix for generated files, and format w… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
Index: pkg/intl/test/data_directory.dart
diff --git a/pkg/intl/test/data_directory.dart b/pkg/intl/test/data_directory.dart
index de16e00d0b8378abbdd9d0da398cfe7b52af22db..8e303f907e9bab3f00da3d782fa061442e669736 100644
--- a/pkg/intl/test/data_directory.dart
+++ b/pkg/intl/test/data_directory.dart
@@ -17,25 +17,28 @@ import "dart:io";
import "package:pathos/path.dart" as path;
String get dataDirectory {
- return path.join(intlDirectory, datesRelativeToIntl);
+ return path.join(intlDirectory(), datesRelativeToIntl);
}
-String get intlDirectory {
+String intlDirectory() {
var components = path.split(path.current);
var foundIntlDir = false;
- /**
- * A helper function that returns false (indicating we should stop iterating)
- * if the argument to the previous call was 'intl' and also sets
- * the outer scope [foundIntl].
- */
- bool checkForIntlDir(String each) {
- if (foundIntlDir) return false;
- foundIntlDir = (each == 'intl') ? true : false;
- return true;
+ List findPathUpToIntl() {
+ var result = [];
+ for (var each in components) {
Siggi Cherem (dart-lang) 2013/04/23 02:12:51 nit: 'each' => 'segment' or 'component'? (general
Emily Fortuna 2013/04/23 17:24:48 +1
Alan Knight 2013/04/23 17:59:56 This is moot, because this file's changes were bec
Siggi Cherem (dart-lang) 2013/04/23 18:56:37 sure - I noticed that the original code is also us
Alan Knight 2013/04/23 21:37:19 Done.
+ if (each == 'intl') {
+ foundIntlDir = true;
+ result.add(each);
+ return result;
+ } else {
+ result.add(each);
+ }
+ }
+ return result;
}
- var pathUpToIntl = components.takeWhile(checkForIntlDir).toList();
+ var pathUpToIntl = findPathUpToIntl();
// We assume that if we're not somewhere underneath the intl hierarchy
// that we are in the dart root.
if (foundIntlDir) {

Powered by Google App Engine
This is Rietveld 408576698