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

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

Issue 13332009: Make listDir and createSymlink synchronous in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 7 years, 9 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/utf8_readme.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 2dc93e529f943c0b1c5049ea03eb3e16a5076871..412d6c3955989978be6e62a9feee8ee0ce7d9f46 100644
--- a/utils/pub/validator/name.dart
+++ b/utils/pub/validator/name.dart
@@ -28,10 +28,11 @@ class NameValidator extends Validator {
: super(entrypoint);
Future validate() {
- _checkName(entrypoint.root.name, 'Package name "${entrypoint.root.name}"',
- isPackage: true);
+ return new Future.of(() {
+ _checkName(entrypoint.root.name, 'Package name "${entrypoint.root.name}"',
+ isPackage: true);
- return _libraries.then((libraries) {
+ var libraries = _libraries;
for (var library in libraries) {
var libName = path.basenameWithoutExtension(library);
_checkName(libName, 'The name of "$library", "$libName",',
@@ -50,18 +51,14 @@ class NameValidator extends Validator {
/// Returns a list of all libraries in the current package as paths relative
/// to the package's root directory.
- Future<List<String>> get _libraries {
+ List<String> get _libraries {
var libDir = path.join(entrypoint.root.dir, "lib");
- return defer(() {
- if (!dirExists(libDir)) return [];
- return listDir(libDir, recursive: true);
- }).then((files) {
- return files
- .map((file) => path.relative(file, from: path.dirname(libDir)))
- .where((file) => !path.split(file).contains("src") &&
- path.extension(file) == '.dart')
- .toList();
- });
+ if (!dirExists(libDir)) return [];
+ return listDir(libDir, recursive: true)
+ .map((file) => path.relative(file, from: path.dirname(libDir)))
+ .where((file) => !path.split(file).contains("src") &&
+ path.extension(file) == '.dart')
+ .toList();
}
void _checkName(String name, String description, {bool isPackage}) {
« no previous file with comments | « utils/pub/validator/license.dart ('k') | utils/pub/validator/utf8_readme.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698