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

Side by Side Diff: lib/src/utils.dart

Issue 2068363002: pkg/test: Resolve a number of analyzer warnings (Closed) Base URL: https://github.com/dart-lang/test.git@master
Patch Set: nits Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « lib/src/util/io.dart ('k') | test/io.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:convert'; 6 import 'dart:convert';
7 import 'dart:math' as math; 7 import 'dart:math' as math;
8 import 'dart:typed_data'; 8 import 'dart:typed_data';
9 9
10 import 'package:async/async.dart' hide StreamQueue; 10 import 'package:async/async.dart' hide StreamQueue;
11 import 'package:path/path.dart' as p; 11 import 'package:path/path.dart' as p;
12 import 'package:shelf/shelf.dart' as shelf; 12 import 'package:shelf/shelf.dart' as shelf;
13 import 'package:stack_trace/stack_trace.dart'; 13 import 'package:stack_trace/stack_trace.dart';
14 14
15 import 'backend/operating_system.dart'; 15 import 'backend/operating_system.dart';
16 import 'util/path_handler.dart'; 16 import 'util/path_handler.dart';
17 import 'util/stream_queue.dart'; 17 import 'util/stream_queue.dart';
18 18
19 /// The maximum console line length. 19 /// The maximum console line length.
20 const _lineLength = 100; 20 const _lineLength = 100;
21 21
22 /// A typedef for a possibly-asynchronous function. 22 /// A typedef for a possibly-asynchronous function.
23 /// 23 ///
24 /// The return type should only ever by [Future] or void. 24 /// The return type should only ever by [Future] or void.
25 typedef AsyncFunction(); 25 typedef AsyncFunction();
26 26
27 /// A typedef for a zero-argument callback function. 27 /// A typedef for a zero-argument callback function.
28 typedef void Callback(); 28 typedef void Callback();
29 29
30 /// A converter that decodes bytes using UTF-8 and splits them on newlines. 30 /// A transformer that decodes bytes using UTF-8 and splits them on newlines.
31 final lineSplitter = UTF8.decoder.fuse(const LineSplitter()); 31 final StreamTransformer<List<int>, String> lineSplitter = new StreamTransformer(
nweiz 2016/06/23 22:22:47 You can probably avoid type-annotating this, too,
kevmoo 2016/06/23 22:32:28 Just putting types on the right seems to do the tr
32 (Stream<List<int>> stream, bool cancelOnError) => stream
nweiz 2016/06/23 22:22:47 Don't type-annotate these. They should be inferred
kevmoo 2016/06/23 22:32:28 Done.
33 .transform(UTF8.decoder)
34 .transform(const LineSplitter())
35 .listen(null, cancelOnError: cancelOnError));
32 36
33 /// A regular expression to match the exception prefix that some exceptions' 37 /// A regular expression to match the exception prefix that some exceptions'
34 /// [Object.toString] values contain. 38 /// [Object.toString] values contain.
35 final _exceptionPrefix = new RegExp(r'^([A-Z][a-zA-Z]*)?(Exception|Error): '); 39 final _exceptionPrefix = new RegExp(r'^([A-Z][a-zA-Z]*)?(Exception|Error): ');
36 40
37 /// A regular expression matching a single vowel. 41 /// A regular expression matching a single vowel.
38 final _vowel = new RegExp('[aeiou]'); 42 final _vowel = new RegExp('[aeiou]');
39 43
40 /// Directories that are specific to OS X. 44 /// Directories that are specific to OS X.
41 /// 45 ///
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 return BASE64.encode(data); 361 return BASE64.encode(data);
358 } 362 }
359 363
360 /// Returns middleware that nests all requests beneath the URL prefix [beneath]. 364 /// Returns middleware that nests all requests beneath the URL prefix [beneath].
361 shelf.Middleware nestingMiddleware(String beneath) { 365 shelf.Middleware nestingMiddleware(String beneath) {
362 return (handler) { 366 return (handler) {
363 var pathHandler = new PathHandler()..add(beneath, handler); 367 var pathHandler = new PathHandler()..add(beneath, handler);
364 return pathHandler.handler; 368 return pathHandler.handler;
365 }; 369 };
366 } 370 }
OLDNEW
« no previous file with comments | « lib/src/util/io.dart ('k') | test/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698