diff --git a/lib/src/barback/admin_server.dart b/lib/src/barback/admin_server.dart index c6fd86fdd030fdd94766dd92d65a6fd6229c324b..057a5888e91435ccca26a10c131a025d0e40b7f1 100644 --- a/lib/src/barback/admin_server.dart +++ b/lib/src/barback/admin_server.dart @@ -10,7 +10,6 @@ import 'dart:io'; import 'package:http_parser/http_parser.dart'; import 'package:shelf/shelf.dart' as shelf; import 'package:shelf_web_socket/shelf_web_socket.dart'; -import 'package:stack_trace/stack_trace.dart'; import '../io.dart'; import '../log.dart' as log; @@ -30,7 +29,7 @@ class AdminServer extends BaseServer { /// Creates a new server and binds it to [port] of [host]. static Future<AdminServer> bind(AssetEnvironment environment, String host, int port) { - return Chain.track(bindServer(host, port)).then((server) { + return bindServer(host, port).then((server) { log.fine('Bound admin server to $host:$port.'); return new AdminServer._(environment, server); }); diff --git a/lib/src/barback/asset_environment.dart b/lib/src/barback/asset_environment.dart index 7b0fca29113b139647522de3f5ecaab5dc059d4a..8df986b1883774adbcb781456f41ee72e01f99d4 100644 --- a/lib/src/barback/asset_environment.dart +++ b/lib/src/barback/asset_environment.dart @@ -669,7 +669,7 @@ class AssetEnvironment { var subscriptions = streams.map((stream) => stream.listen((_) {}, onError: completer.complete)).toList(); - syncFuture(futureCallback).then((_) { + new Future.sync(futureCallback).then((_) { if (!completer.isCompleted) completer.complete(); }).catchError((error, stackTrace) { if (!completer.isCompleted) completer.completeError(error, stackTrace); diff --git a/lib/src/barback/barback_server.dart b/lib/src/barback/barback_server.dart index 7d9125a89fa446bd6721815c53467fb7862b5553..2f1b4f8e350f0d93c9dfad1c2448a0d7ea5dc07e 100644 --- a/lib/src/barback/barback_server.dart +++ b/lib/src/barback/barback_server.dart @@ -54,7 +54,7 @@ class BarbackServer extends BaseServer<BarbackServerResult> { static Future<BarbackServer> bind(AssetEnvironment environment, String host, int port, {String package, String rootDirectory}) { if (package == null) package = environment.rootPackage.name; - return Chain.track(bindServer(host, port)).then((server) { + return bindServer(host, port).then((server) { if (rootDirectory == null) { log.fine('Serving packages on $host:$port.'); } else { diff --git a/lib/src/barback/base_server.dart b/lib/src/barback/base_server.dart index 95dc355562341cbab81f716af11186c0107c24e1..cb23036f17a79bbabab63bc4133e68809c74d13c 100644 --- a/lib/src/barback/base_server.dart +++ b/lib/src/barback/base_server.dart @@ -11,7 +11,6 @@ import 'dart:io'; import 'package:barback/barback.dart'; import 'package:shelf/shelf.dart' as shelf; import 'package:shelf/shelf_io.dart' as shelf_io; -import 'package:stack_trace/stack_trace.dart'; import '../log.dart' as log; import '../utils.dart'; @@ -43,7 +42,7 @@ abstract class BaseServer<T> { final _resultsController = new StreamController<T>.broadcast(); BaseServer(this.environment, this._server) { - shelf_io.serveRequests(Chain.track(_server), const shelf.Pipeline() + shelf_io.serveRequests(_server, const shelf.Pipeline() .addMiddleware(shelf.createMiddleware(errorHandler: _handleError)) .addMiddleware(shelf.createMiddleware(responseHandler: _disableGzip)) .addHandler(handleRequest)); diff --git a/lib/src/barback/dart2js_transformer.dart b/lib/src/barback/dart2js_transformer.dart index 1b22647b694f8600f650604f36aec63938b33086..a535a5bdaa20f6fe7b6cc2b59db6e5e1f707a50b 100644 --- a/lib/src/barback/dart2js_transformer.dart +++ b/lib/src/barback/dart2js_transformer.dart @@ -11,7 +11,6 @@ import 'package:analyzer/analyzer.dart'; import 'package:barback/barback.dart'; import 'package:path/path.dart' as path; import 'package:pool/pool.dart'; -import 'package:stack_trace/stack_trace.dart'; import '../../../../compiler/compiler.dart' as compiler; import '../../../../compiler/implementation/dart2js.dart' @@ -132,7 +131,7 @@ class Dart2JSTransformer extends Transformer implements LazyTransformer { // to report compile errors to the user in an easily visible way. Need to // make sure paths in errors are mapped to the original source path so they // can understand them. - return Chain.track(dart.compile( + return dart.compile( entrypoint, provider, commandLineOptions: _configCommandLineOptions, csp: _configBool('csp'), @@ -148,7 +147,7 @@ class Dart2JSTransformer extends Transformer implements LazyTransformer { suppressPackageWarnings: _configBool( 'suppressPackageWarnings', defaultsTo: true), terse: _configBool('terse'), - includeSourceMapUrls: _settings.mode != BarbackMode.RELEASE)); + includeSourceMapUrls: _settings.mode != BarbackMode.RELEASE); } /// Parses and returns the "commandLineOptions" configuration option. @@ -373,7 +372,7 @@ class _BarbackCompilerProvider implements dart.CompilerProvider { } Future<String> _readResource(Uri url) { - return syncFuture(() { + return new Future.sync(() { // Find the corresponding asset in barback. var id = _sourceUrlToId(url); if (id != null) return _transform.readInputAsString(id); diff --git a/lib/src/command.dart b/lib/src/command.dart index d70bf1733ef3ed52ef1c563ae8af384e948be04a..0c92abda4ea79bf6f6470adc3bb8b093144e0920 100644 --- a/lib/src/command.dart +++ b/lib/src/command.dart @@ -197,7 +197,7 @@ abstract class PubCommand { _cache = new SystemCache.withSources(cacheDir, isOffline: isOffline); _globals = new GlobalPackages(_cache); - return syncFuture(onRun); + return new Future.sync(onRun); } /// Override this to perform the specific command. diff --git a/lib/src/command/uploader.dart b/lib/src/command/uploader.dart index 0324dcbb92127171674a1299eca65c58cc995772..f74915d9379f62eb96c054babeafda253d5d2f47 100644 --- a/lib/src/command/uploader.dart +++ b/lib/src/command/uploader.dart @@ -16,7 +16,6 @@ import '../io.dart'; import '../log.dart' as log; import '../oauth2.dart' as oauth2; import '../source/hosted.dart'; -import '../utils.dart'; /// Handles the `uploader` pub command. class UploaderCommand extends PubCommand { @@ -58,7 +57,7 @@ class UploaderCommand extends PubCommand { return flushThenExit(exit_codes.USAGE); } - return syncFuture(() { + return new Future.sync(() { var package = commandOptions['package']; if (package != null) return package; return new Entrypoint(path.current, cache).root.name; diff --git a/lib/src/dart.dart b/lib/src/dart.dart index 85035f2659a9a6f0304ea1e93b7ce990d9e9a27c..fae307e6ed2b12b97397cbf3dd2448df9a837f87 100644 --- a/lib/src/dart.dart +++ b/lib/src/dart.dart @@ -11,7 +11,6 @@ import 'dart:isolate'; import 'package:analyzer/analyzer.dart'; import 'package:path/path.dart' as path; -import 'package:stack_trace/stack_trace.dart'; import '../../../compiler/compiler.dart' as compiler; import '../../../compiler/implementation/filenames.dart' @@ -21,7 +20,6 @@ import '../../asset/dart/serialize.dart'; import 'io.dart'; import 'log.dart' as log; -import 'utils.dart'; /// Interface to communicate with dart2js. /// /// This is basically an amalgamation of dart2js's @@ -73,7 +71,7 @@ Future compile(String entrypoint, CompilerProvider provider, { bool terse: false, bool includeSourceMapUrls: false, bool toDart: false}) { - return syncFuture(() { + return new Future.sync(() { var options = <String>['--categories=Client,Server']; if (checked) options.add('--enable-checked-mode'); if (csp) options.add('--csp'); @@ -101,7 +99,7 @@ Future compile(String entrypoint, CompilerProvider provider, { packageRoot = path.join(path.dirname(entrypoint), 'packages'); } - return Chain.track(compiler.compile( + return compiler.compile( path.toUri(entrypoint), provider.libraryRoot, path.toUri(appendSlash(packageRoot)), @@ -109,7 +107,7 @@ Future compile(String entrypoint, CompilerProvider provider, { provider.handleDiagnostic, options, provider.provideOutput, - environment)); + environment); }); } @@ -158,18 +156,18 @@ class _DirectiveCollector extends GeneralizingAstVisitor { Future runInIsolate(String code, message, {String snapshot}) { if (snapshot != null && fileExists(snapshot)) { log.fine("Spawning isolate from $snapshot."); - return Chain.track(Isolate.spawnUri(path.toUri(snapshot), [], message)); + return Isolate.spawnUri(path.toUri(snapshot), [], message); } return withTempDir((dir) async { var dartPath = path.join(dir, 'runInIsolate.dart'); writeTextFile(dartPath, code, dontLogContents: true); var port = new ReceivePort(); - await Chain.track(Isolate.spawn(_isolateBuffer, { + await Isolate.spawn(_isolateBuffer, { 'replyTo': port.sendPort, 'uri': path.toUri(dartPath).toString(), 'message': message - })); + }); var response = await port.first; if (response['type'] == 'error') { @@ -200,8 +198,7 @@ Future runInIsolate(String code, message, {String snapshot}) { /// Adding an additional isolate in the middle works around this. void _isolateBuffer(message) { var replyTo = message['replyTo']; - Chain.track(Isolate.spawnUri( - Uri.parse(message['uri']), [], message['message'])) + Isolate.spawnUri(Uri.parse(message['uri']), [], message['message']) .then((_) => replyTo.send({'type': 'success'})) .catchError((e, stack) { replyTo.send({ diff --git a/lib/src/entrypoint.dart b/lib/src/entrypoint.dart index 8ecaff6c98e4b67928116b5e791c4a7a42280e2b..13aa2f63bd3669a61f6a4908d199f64697e85b4b 100644 --- a/lib/src/entrypoint.dart +++ b/lib/src/entrypoint.dart @@ -329,7 +329,7 @@ class Entrypoint { if (id.isRoot) return new Future.value(id); var source = cache.sources[id.source]; - return syncFuture(() { + return new Future.sync(() { if (!_packageSymlinks) { if (source is! CachedSource) return null; return source.downloadToSystemCache(id); @@ -394,7 +394,7 @@ class Entrypoint { /// Gets dependencies if the lockfile is out of date with respect to the /// pubspec. Future ensureLockFileIsUpToDate() { - return syncFuture(() { + return new Future.sync(() { // If we don't have a current lock file, we definitely need to install. if (!_isLockFileUpToDate(lockFile)) { if (lockFileExists) { @@ -435,7 +435,7 @@ class Entrypoint { Future<PackageGraph> loadPackageGraph([SolveResult result]) { if (_packageGraph != null) return new Future.value(_packageGraph); - return syncFuture(() { + return new Future.sync(() { if (result != null) { return Future.wait(result.packages.map((id) { return cache.sources[id.source].getDirectory(id) diff --git a/lib/src/global_packages.dart b/lib/src/global_packages.dart index 2b9d5edb8dcf23828cd5a9e69a453b68fc2bebb7..602f5283c0e65b69fed9cd358239ee51c3d8818b 100644 --- a/lib/src/global_packages.dart +++ b/lib/src/global_packages.dart @@ -285,7 +285,7 @@ class GlobalPackages { Future<Entrypoint> find(String name) { // TODO(rnystrom): Use async/await here when on __ catch is supported. // See: https://github.com/dart-lang/async_await/issues/27 - return syncFuture(() { + return new Future.sync(() { var lockFilePath = _getLockFilePath(name); var lockFile; try { diff --git a/lib/src/io.dart b/lib/src/io.dart index f3b0f1c4ccfe5bc47a0f2b44960eb4ae3ba04811..c55c17b67e345308edbe6b4e2e02fed1787267e2 100644 --- a/lib/src/io.dart +++ b/lib/src/io.dart @@ -195,7 +195,7 @@ Future<String> createFileFromStream(Stream<List<int>> stream, String file) { log.io("Creating $file from stream."); return _descriptorPool.withResource(() { - return Chain.track(stream.pipe(new File(file).openWrite())).then((_) { + return stream.pipe(new File(file).openWrite()).then((_) { log.fine("Created $file from stream."); return file; }); @@ -508,7 +508,7 @@ String get repoRoot { /// A line-by-line stream of standard input. final Stream<String> stdinLines = streamToLines( - new ByteStream(Chain.track(stdin)).toStringStream()); + new ByteStream(stdin).toStringStream()); /// Displays a message and reads a yes/no confirmation from the user. /// @@ -543,8 +543,8 @@ Future drainStream(Stream stream) { /// after you've decided to exit. Future flushThenExit(int status) { return Future.wait([ - Chain.track(stdout.close()), - Chain.track(stderr.close()) + stdout.close(), + stderr.close() ]).then((_) => exit(status)); } @@ -703,16 +703,15 @@ class PubProcess { var pair = consumerToSink(process.stdin); _stdin = pair.first; - _stdinClosed = errorGroup.registerFuture(Chain.track(pair.last)); + _stdinClosed = errorGroup.registerFuture(pair.last); _stdout = new ByteStream( - errorGroup.registerStream(Chain.track(process.stdout))); + errorGroup.registerStream(process.stdout)); _stderr = new ByteStream( - errorGroup.registerStream(Chain.track(process.stderr))); + errorGroup.registerStream(process.stderr)); var exitCodeCompleter = new Completer(); - _exitCode = errorGroup.registerFuture( - Chain.track(exitCodeCompleter.future)); + _exitCode = errorGroup.registerFuture(exitCodeCompleter.future); _process.exitCode.then((code) => exitCodeCompleter.complete(code)); } @@ -794,9 +793,9 @@ Future timeout(Future input, int milliseconds, Uri url, String description) { /// Returns a future that completes to the value that the future returned from /// [fn] completes to. Future withTempDir(Future fn(String path)) { - return syncFuture(() { + return new Future.sync(() { var tempDir = createSystemTempDir(); - return syncFuture(() => fn(tempDir)) + return new Future.sync(() => fn(tempDir)) .whenComplete(() => deleteEntry(tempDir)); }); } @@ -931,7 +930,7 @@ Future<bool> _extractTarGzWindows(Stream<List<int>> stream, /// /// Returns a [ByteStream] that emits the contents of the archive. ByteStream createTarGz(List contents, {baseDir}) { - return new ByteStream(futureStream(syncFuture(() { + return new ByteStream(futureStream(new Future.sync(() { var buffer = new StringBuffer(); buffer.write('Creating .tag.gz stream containing:\n'); contents.forEach((file) => buffer.write('$file\n')); @@ -960,7 +959,7 @@ ByteStream createTarGz(List contents, {baseDir}) { // Don't use [withTempDir] here because we don't want to delete the temp // directory until the returned stream has closed. var tempDir = createSystemTempDir(); - return syncFuture(() { + return new Future.sync(() { // Create the tar file. var tarFile = path.join(tempDir, "intermediate.tar"); var args = ["a", "-w$baseDir", tarFile]; diff --git a/lib/src/solver/backtracking_solver.dart b/lib/src/solver/backtracking_solver.dart index cf12722fcb92ab15a12bfacd77ab8300265533e8..8f19a66287efb94ea20a19029038f20a5fb5b6c5 100644 --- a/lib/src/solver/backtracking_solver.dart +++ b/lib/src/solver/backtracking_solver.dart @@ -559,7 +559,7 @@ class Traverser { /// Register [dependency]'s constraints on the package it depends on and /// enqueues the package for processing if necessary. Future _registerDependency(Dependency dependency) { - return syncFuture(() { + return new Future.sync(() { _validateDependency(dependency); var dep = dependency.dep; diff --git a/lib/src/source/git.dart b/lib/src/source/git.dart index 9696f45beeb8c6cb443dad3dda585cafce427069..9d08f83fc1e7588ba35494409bf0c9608a786c4f 100644 --- a/lib/src/source/git.dart +++ b/lib/src/source/git.dart @@ -187,7 +187,7 @@ class GitSource extends CachedSource { /// Returns a future that completes to the hash of the revision identified by /// [id]. Future<String> _ensureRevision(PackageId id) { - return syncFuture(() { + return new Future.sync(() { var path = _repoCachePath(id); if (!entryExists(path)) { return _clone(_getUrl(id), path, mirror: true) @@ -244,7 +244,7 @@ class GitSource extends CachedSource { /// for the repository. Future _clone(String from, String to, {bool mirror: false, bool shallow: false}) { - return syncFuture(() { + return new Future.sync(() { // Git on Windows does not seem to automatically create the destination // directory. ensureDir(to); diff --git a/lib/src/source/hosted.dart b/lib/src/source/hosted.dart index 5dcba33efcffd135d2d7b46745fee0a8ff704039..2c12dd8c2256cbf964b842ba289f2d97b6bcac12 100644 --- a/lib/src/source/hosted.dart +++ b/lib/src/source/hosted.dart @@ -171,7 +171,7 @@ class HostedSource extends CachedSource { /// into [destPath]. Future<bool> _download(String server, String package, Version version, String destPath) { - return syncFuture(() { + return new Future.sync(() { var url = Uri.parse("$server/packages/$package/versions/$version.tar.gz"); log.io("Get package from $url."); log.message('Downloading ${log.bold(package)} ${version}...'); diff --git a/lib/src/source/path.dart b/lib/src/source/path.dart index fc13cc7c9ad8bfd1c08c24d93e22c8945415b5cc..c1fbd52f75815a8db7cd007aa4469a1341298f5f 100644 --- a/lib/src/source/path.dart +++ b/lib/src/source/path.dart @@ -35,7 +35,7 @@ class PathSource extends Source { final name = 'path'; Future<Pubspec> doDescribe(PackageId id) { - return syncFuture(() { + return new Future.sync(() { var dir = _validatePath(id.name, id.description); return new Pubspec.load(dir, systemCache.sources, expectedName: id.name); @@ -50,7 +50,7 @@ class PathSource extends Source { } Future get(PackageId id, String symlink) { - return syncFuture(() { + return new Future.sync(() { var dir = _validatePath(id.name, id.description); createPackageSymlink(id.name, dir, symlink, relative: id.description["relative"]); diff --git a/lib/src/utils.dart b/lib/src/utils.dart index a6fa15dc9ff1b737a146e82f3e7fd1dfd07030d5..aea04010794a0f3284673ed13b826bed1c4ca84c 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -85,10 +85,6 @@ class FutureGroup<T> { /// under the covers. Future newFuture(callback()) => new Future.value().then((_) => callback()); -/// Like [new Future.sync], but automatically wraps the future in a -/// [Chain.track] call. -Future syncFuture(callback()) => Chain.track(new Future.sync(callback)); - /// Runs [callback] in an error zone and pipes any unhandled error to the /// returned [Future]. /// @@ -346,8 +342,8 @@ Future<Map> mapFromIterableAsync(Iterable iter, {key(element), var map = new Map(); return Future.wait(iter.map((element) { return Future.wait([ - syncFuture(() => key(element)), - syncFuture(() => value(element)) + new Future.sync(() => key(element)), + new Future.sync(() => value(element)) ]).then((results) { map[results[0]] = results[1]; }); diff --git a/lib/src/validator/compiled_dartdoc.dart b/lib/src/validator/compiled_dartdoc.dart index 6ad79ce6b535939e08cf7e1462b9a2a9ddde4dfc..73b40e7f400149744bc845b2b2d8fb5ac6989ea4 100644 --- a/lib/src/validator/compiled_dartdoc.dart +++ b/lib/src/validator/compiled_dartdoc.dart @@ -10,7 +10,6 @@ import 'package:path/path.dart' as path; import '../entrypoint.dart'; import '../io.dart'; -import '../utils.dart'; import '../validator.dart'; /// Validates that a package doesn't contain compiled Dartdoc @@ -20,7 +19,7 @@ class CompiledDartdocValidator extends Validator { : super(entrypoint); Future validate() { - return syncFuture(() { + return new Future.sync(() { for (var entry in entrypoint.root.listFiles()) { if (path.basename(entry) != "nav.json") continue; var dir = path.dirname(entry); diff --git a/lib/src/validator/directory.dart b/lib/src/validator/directory.dart index f733e4e42d71f995c7d092c1d9fae947e2dc78e5..6039fc5c3b02f9be04a4568fe87e1bfab218d64c 100644 --- a/lib/src/validator/directory.dart +++ b/lib/src/validator/directory.dart @@ -10,7 +10,6 @@ import 'package:path/path.dart' as path; import '../entrypoint.dart'; import '../io.dart'; -import '../utils.dart'; import '../validator.dart'; /// A validator that validates a package's top-level directories. @@ -23,7 +22,7 @@ class DirectoryValidator extends Validator { ]; Future validate() { - return syncFuture(() { + return new Future.sync(() { for (var dir in listDir(entrypoint.root.dir)) { if (!dirExists(dir)) continue; diff --git a/lib/src/validator/executable.dart b/lib/src/validator/executable.dart index 23bc5e53e88f166778929fc59980c813db0c2441..8bf404924e45a370e10f1fb03fb1be393bd54c03 100644 --- a/lib/src/validator/executable.dart +++ b/lib/src/validator/executable.dart @@ -9,8 +9,6 @@ import 'dart:async'; import 'package:path/path.dart' as p; import '../entrypoint.dart'; -import '../io.dart'; -import '../utils.dart'; import '../validator.dart'; /// Validates that a package's pubspec doesn't contain executables that diff --git a/lib/src/validator/license.dart b/lib/src/validator/license.dart index ffad6a7d9181f854b47fa78cf35fda1edbc6d763..6ac2875d63a5954e407f8f8a358144d7ce8bcc7e 100644 --- a/lib/src/validator/license.dart +++ b/lib/src/validator/license.dart @@ -19,7 +19,7 @@ class LicenseValidator extends Validator { : super(entrypoint); Future validate() { - return syncFuture(() { + return new Future.sync(() { var licenseLike = new RegExp( r"^([a-zA-Z0-9]+[-_])?(LICENSE|COPYING)(\..*)?$"); if (listDir(entrypoint.root.dir) diff --git a/lib/src/validator/name.dart b/lib/src/validator/name.dart index 585a3df877a5fb31868515c3f7edb9ae6acc80d0..82e40b7e2a530e59e656c63450c428ccfabd9ee9 100644 --- a/lib/src/validator/name.dart +++ b/lib/src/validator/name.dart @@ -27,7 +27,7 @@ class NameValidator extends Validator { : super(entrypoint); Future validate() { - return syncFuture(() { + return new Future.sync(() { _checkName(entrypoint.root.name, 'Package name "${entrypoint.root.name}"', isPackage: true); diff --git a/lib/src/validator/utf8_readme.dart b/lib/src/validator/utf8_readme.dart index da0c2233ccad333367e95206d22df90df7b0c808..9f30d65599d7668fecd5c13806edeb3d5c30742e 100644 --- a/lib/src/validator/utf8_readme.dart +++ b/lib/src/validator/utf8_readme.dart @@ -9,7 +9,6 @@ import 'dart:convert'; import '../entrypoint.dart'; import '../io.dart'; -import '../utils.dart'; import '../validator.dart'; /// Validates that a package's README is valid utf-8. @@ -18,7 +17,7 @@ class Utf8ReadmeValidator extends Validator { : super(entrypoint); Future validate() { - return syncFuture(() { + return new Future.sync(() { var readme = entrypoint.root.readmePath; if (readme == null) return; var bytes = readBinaryFile(readme); diff --git a/test/serve/utils.dart b/test/serve/utils.dart index f3a6fa87765343d984af9c32e3ca58dbce8700a2..9516cd2ddb41fccb7d170dc42eae4b6a25938741 100644 --- a/test/serve/utils.dart +++ b/test/serve/utils.dart @@ -456,8 +456,8 @@ Future<Map> _jsonRpcRequest(String method, [Map params]) { if (params != null) message["params"] = params; _webSocket.add(JSON.encode(message)); - return Chain.track(_webSocketBroadcastStream - .firstWhere((response) => response["id"] == id)).then((value) { + return _webSocketBroadcastStream + .firstWhere((response) => response["id"] == id).then((value) { currentSchedule.addDebugInfo( "Web Socket request $method with params $params\n" "Result: $value"); diff --git a/test/test_pub.dart b/test/test_pub.dart index b2b2541f4f6b3a0ed7a49f268b5a19a8130cdf45..ca1e667932e180180c2e187fa998436be402c4de 100644 --- a/test/test_pub.dart +++ b/test/test_pub.dart @@ -934,7 +934,7 @@ Future<Pair<List<String>, List<String>>> schedulePackageValidation( return schedule(() { var cache = new SystemCache.withSources(p.join(sandboxDir, cachePath)); - return syncFuture(() { + return new Future.sync(() { var validator = fn(new Entrypoint(p.join(sandboxDir, appPath), cache)); return validator.validate().then((_) { return new Pair(validator.errors, validator.warnings); diff --git a/test/version_solver_test.dart b/test/version_solver_test.dart index d98a5bff0a875b18cb7cd7f58a7641b747111aa3..7673fde1184fe48e7ec959f7c5db3e2c273af01a 100644 --- a/test/version_solver_test.dart +++ b/test/version_solver_test.dart @@ -1378,7 +1378,7 @@ class MockSource extends CachedSource { } Future<List<Version>> getVersions(String name, String description) { - return syncFuture(() { + return new Future.sync(() { // Make sure the solver doesn't request the same thing twice. if (_requestedVersions.contains(description)) { throw new Exception('Version list for $description was already ' @@ -1397,7 +1397,7 @@ class MockSource extends CachedSource { } Future<Pubspec> describeUncached(PackageId id) { - return syncFuture(() { + return new Future.sync(() { // Make sure the solver doesn't request the same thing twice. if (_requestedPubspecs.containsKey(id.description) && _requestedPubspecs[id.description].contains(id.version)) {