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

Unified Diff: utils/pub/validator/name.dart

Issue 11785028: Commit Martin's patch for pub + lib_v2. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 7 years, 11 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 | « utils/pub/validator/license.dart ('k') | utils/pub/validator/pubspec_field.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/validator/name.dart
diff --git a/utils/pub/validator/name.dart b/utils/pub/validator/name.dart
index 8d9e93dfe49f3e83c5a3410ce294a16224e99111..67e2da0257bc6bca4a76f96843f46fe741622506 100644
--- a/utils/pub/validator/name.dart
+++ b/utils/pub/validator/name.dart
@@ -4,6 +4,7 @@
library name_validator;
+import 'dart:async';
import 'dart:io';
import '../../../pkg/path/lib/path.dart' as path;
@@ -26,7 +27,7 @@ class NameValidator extends Validator {
Future validate() {
_checkName(entrypoint.root.name, 'Package name "${entrypoint.root.name}"');
- return _libraries.transform((libraries) {
+ return _libraries.then((libraries) {
for (var library in libraries) {
var libName = path.basenameWithoutExtension(library);
_checkName(libName, 'The name of "$library", "$libName",');
@@ -46,15 +47,15 @@ class NameValidator extends Validator {
/// to the package's root directory.
Future<List<String>> get _libraries {
var libDir = join(entrypoint.root.dir, "lib");
- return dirExists(libDir).chain((libDirExists) {
+ return dirExists(libDir).then((libDirExists) {
if (!libDirExists) return new Future.immediate([]);
return listDir(libDir, recursive: true);
}).then((files) {
- return files.map((file) => relativeTo(file, dirname(libDir)))
- .filter((file) {
- return !splitPath(file).contains("src") &&
- path.extension(file) == '.dart';
- });
+ return files
+ .mappedBy((file) => relativeTo(file, dirname(libDir)))
+ .where((file) => !splitPath(file).contains("src") &&
+ path.extension(file) == '.dart')
+ .toList();
});
}
« no previous file with comments | « utils/pub/validator/license.dart ('k') | utils/pub/validator/pubspec_field.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698