Skip to content

Commit 298dbe2

Browse files
authored
Remove unused or unneeded members (#1728)
1 parent be28505 commit 298dbe2

File tree

6 files changed

+3
-92
lines changed

6 files changed

+3
-92
lines changed

lib/src/command/barback.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import '../io.dart';
1313
import '../log.dart' as log;
1414
import '../utils.dart';
1515

16-
final _arrow = getSpecial('\u2192', '=>');
17-
1816
/// The set of top level directories in the entrypoint package that are built
1917
/// when the user does "--all".
2018
final _allSourceDirectories =

lib/src/command/build.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import '../source/hosted.dart';
1515
import '../utils.dart';
1616
import 'barback.dart';
1717

18-
final _arrow = getSpecial('\u2192', '=>');
19-
2018
/// Handles the `build` pub command.
2119
class BuildCommand extends BarbackCommand {
2220
String get name => "build";

lib/src/command/lish.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ class LishCommand extends PubCommand {
9999
});
100100
} on PubHttpException catch (error) {
101101
var url = error.response.request.url;
102-
if (urisEqual(url, cloudStorageUrl)) {
102+
if (url == cloudStorageUrl) {
103103
// TODO(nweiz): the response may have XML-formatted information about
104104
// the error. Try to parse that out once we have an easily-accessible
105105
// XML parser.
106106
fail(log.red('Failed to upload the package.'));
107-
} else if (urisEqual(Uri.parse(url.origin), Uri.parse(server.origin))) {
107+
} else if (Uri.parse(url.origin) == Uri.parse(server.origin)) {
108108
handleJsonError(error.response);
109109
} else {
110110
rethrow;

lib/src/http.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ class _PubHttpClient extends http.BaseClient {
9494
// 401 responses should be handled by the OAuth2 client. It's very
9595
// unlikely that they'll be returned by non-OAuth2 requests. We also want
9696
// to pass along 400 responses from the token endpoint.
97-
var tokenRequest =
98-
urisEqual(streamedResponse.request.url, oauth2.tokenEndpoint);
97+
var tokenRequest = streamedResponse.request.url == oauth2.tokenEndpoint;
9998
if (status < 400 || status == 401 || (status == 400 && tokenRequest)) {
10099
return streamedResponse;
101100
}

lib/src/utils.dart

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -292,33 +292,6 @@ List/*<T>*/ ordered/*<T extends Comparable<T>>*/(Iterable/*<T>*/ iter) {
292292
return list;
293293
}
294294

295-
/// Returns the element of [iter] for which [f] returns the minimum value.
296-
minBy(Iterable iter, Comparable f(element)) {
297-
var min = null;
298-
var minComparable = null;
299-
for (var element in iter) {
300-
var comparable = f(element);
301-
if (minComparable == null || comparable.compareTo(minComparable) < 0) {
302-
min = element;
303-
minComparable = comparable;
304-
}
305-
}
306-
return min;
307-
}
308-
309-
/// Returns every pair of consecutive elements in [iter].
310-
///
311-
/// For example, if [iter] is `[1, 2, 3, 4]`, this will return `[(1, 2), (2, 3),
312-
/// (3, 4)]`.
313-
Iterable<Pair> pairs(Iterable iter) {
314-
var previous = iter.first;
315-
return iter.skip(1).map((element) {
316-
var oldPrevious = previous;
317-
previous = element;
318-
return new Pair(oldPrevious, element);
319-
});
320-
}
321-
322295
/// Given a list of filenames, returns a set of patterns that can be used to
323296
/// filter for those filenames.
324297
///
@@ -356,15 +329,6 @@ maxAll(Iterable iter, [int compare(element1, element2)]) {
356329
.reduce((max, element) => compare(element, max) > 0 ? element : max);
357330
}
358331

359-
/// Returns the minimum value in [iter] by [compare].
360-
///
361-
/// [compare] defaults to [Comparable.compare].
362-
minAll(Iterable iter, [int compare(element1, element2)]) {
363-
if (compare == null) compare = Comparable.compare;
364-
return iter
365-
.reduce((max, element) => compare(element, max) < 0 ? element : max);
366-
}
367-
368332
/// Replace each instance of [matcher] in [source] with the return value of
369333
/// [fn].
370334
String replace(String source, Pattern matcher, String fn(Match)) {
@@ -379,14 +343,6 @@ String replace(String source, Pattern matcher, String fn(Match)) {
379343
return buffer.toString();
380344
}
381345

382-
/// Returns whether or not [str] ends with [matcher].
383-
bool endsWithPattern(String str, Pattern matcher) {
384-
for (var match in matcher.allMatches(str)) {
385-
if (match.end == str.length) return true;
386-
}
387-
return false;
388-
}
389-
390346
/// Returns the hex-encoded sha1 hash of [source].
391347
String sha1(String source) =>
392348
crypto.sha1.convert(UTF8.encode(source)).toString();
@@ -484,17 +440,6 @@ Future streamFirst(Stream stream) {
484440
return completer.future;
485441
}
486442

487-
/// Returns a wrapped version of [stream] along with a [StreamSubscription] that
488-
/// can be used to control the wrapped stream.
489-
Pair<Stream, StreamSubscription> streamWithSubscription(Stream stream) {
490-
var controller = stream.isBroadcast
491-
? new StreamController.broadcast(sync: true)
492-
: new StreamController(sync: true);
493-
var subscription = stream.listen(controller.add,
494-
onError: controller.addError, onDone: controller.close);
495-
return new Pair<Stream, StreamSubscription>(controller.stream, subscription);
496-
}
497-
498443
/// A regular expression matching a trailing CR character.
499444
final _trailingCR = new RegExp(r"\r$");
500445

@@ -530,19 +475,6 @@ Stream<String> streamToLines(Stream<String> stream) {
530475
}));
531476
}
532477

533-
/// Like [Iterable.where], but allows [test] to return [Future]s and uses the
534-
/// results of those [Future]s as the test.
535-
Future<Iterable> futureWhere(Iterable iter, test(value)) {
536-
return Future
537-
.wait(iter.map((e) {
538-
var result = test(e);
539-
if (result is! Future) result = new Future.value(result);
540-
return result.then((result) => new Pair(e, result));
541-
}))
542-
.then((pairs) => pairs.where((pair) => pair.last))
543-
.then((pairs) => pairs.map((pair) => pair.first));
544-
}
545-
546478
// TODO(nweiz): unify the following functions with the utility functions in
547479
// pkg/http.
548480

@@ -602,19 +534,6 @@ String mapToQuery(Map<String, String> map) {
602534
Set/*<T>*/ unionAll/*<T>*/(Iterable<Set/*<T>*/ > sets) =>
603535
sets.fold(new Set(), (union, set) => union.union(set));
604536

605-
// TODO(nweiz): remove this when issue 9068 has been fixed.
606-
/// Whether [uri1] and [uri2] are equal.
607-
///
608-
/// This consider HTTP URIs to default to port 80, and HTTPs URIs to default to
609-
/// port 443.
610-
bool urisEqual(Uri uri1, Uri uri2) =>
611-
canonicalizeUri(uri1) == canonicalizeUri(uri2);
612-
613-
/// Return [uri] with redundant port information removed.
614-
Uri canonicalizeUri(Uri uri) {
615-
return uri;
616-
}
617-
618537
/// Returns a human-friendly representation of [inputPath].
619538
///
620539
/// If [inputPath] isn't too distant from the current working directory, this

test/test_pub.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ final String packagesPath = "$appPath/packages";
7474
/// to the sandbox directory.
7575
final String packagesFilePath = "$appPath/.packages";
7676

77-
/// Set to true when the current batch of scheduled events should be aborted.
78-
bool _abortScheduled = false;
79-
8077
/// Enum identifying a pub command that can be run with a well-defined success
8178
/// output.
8279
class RunCommand {

0 commit comments

Comments
 (0)