From cf9c80430f1062f2ad41c9e936b754d0d2d7199b Mon Sep 17 00:00:00 2001 From: "lrn@google.com" <lrn@google.com> Date: Mon, 25 Feb 2013 10:48:09 +0000 Subject: [PATCH] Remove deprecated string features. Make String.codeUnits return a List. Review URL: https://codereview.chromium.org//12282038 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge@18960 260f80e4-7a28-3924-810f-c04153c831b5 --- lib/src/hosted_source.dart | 2 +- lib/src/io.dart | 2 +- lib/src/log.dart | 14 +++++++------- lib/src/utils.dart | 2 +- test/test_pub.dart | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/src/hosted_source.dart b/lib/src/hosted_source.dart index 7529a872..ef64d59c 100644 --- a/lib/src/hosted_source.dart +++ b/lib/src/hosted_source.dart @@ -95,7 +95,7 @@ class HostedSource extends Source { var parsed = _parseDescription(id.description); var url = parsed.last.replaceAll(new RegExp(r"^https?://"), ""); var urlDir = replace(url, new RegExp(r'[<>:"\\/|?*%]'), (match) { - return '%${match[0].charCodeAt(0)}'; + return '%${match[0].codeUnitAt(0)}'; }); return new Future.immediate( diff --git a/lib/src/io.dart b/lib/src/io.dart index c70eb640..856413d5 100644 --- a/lib/src/io.dart +++ b/lib/src/io.dart @@ -383,7 +383,7 @@ final Stream<String> stdinLines = streamToLines( /// should just be a fragment like, "Are you sure you want to proceed". Future<bool> confirm(String message) { log.fine('Showing confirm message: $message'); - stdoutSink.add("$message (y/n)? ".charCodes); + stdoutSink.add("$message (y/n)? ".codeUnits); return streamFirst(stdinLines) .then((line) => new RegExp(r"^[yY]").hasMatch(line)); } diff --git a/lib/src/log.dart b/lib/src/log.dart index 9a555ea3..606aa41d 100644 --- a/lib/src/log.dart +++ b/lib/src/log.dart @@ -153,11 +153,11 @@ void recordTranscript() { void dumpTranscript() { if (_transcript == null) return; - stderrSink.add('---- Log transcript ----\n'.charCodes); + stderrSink.add('---- Log transcript ----\n'.codeUnits); for (var entry in _transcript) { _logToStderrWithLabel(entry); } - stderrSink.add('---- End log transcript ----\n'.charCodes); + stderrSink.add('---- End log transcript ----\n'.codeUnits); } /// Sets the verbosity to "normal", which shows errors, warnings, and messages. @@ -213,15 +213,15 @@ void _logToStream(StreamSink<List<int>> sink, Entry entry, {bool showLabel}) { for (var line in entry.lines) { if (showLabel) { if (firstLine) { - sink.add(entry.level.name.charCodes); - sink.add(': '.charCodes); + sink.add(entry.level.name.codeUnits); + sink.add(': '.codeUnits); } else { - sink.add(' | '.charCodes); + sink.add(' | '.codeUnits); } } - sink.add(line.charCodes); - sink.add('\n'.charCodes); + sink.add(line.codeUnits); + sink.add('\n'.codeUnits); firstLine = false; } diff --git a/lib/src/utils.dart b/lib/src/utils.dart index f7589dae..e03343f5 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -141,7 +141,7 @@ bool endsWithPattern(String str, Pattern matcher) { /// Returns the hex-encoded sha1 hash of [source]. String sha1(String source) { var sha = new SHA1(); - sha.add(source.charCodes); + sha.add(source.codeUnits); return CryptoUtils.bytesToHex(sha.close()); } diff --git a/test/test_pub.dart b/test/test_pub.dart index 823dd129..a8587cf0 100644 --- a/test/test_pub.dart +++ b/test/test_pub.dart @@ -1430,7 +1430,7 @@ class ScheduledProcess { /// Writes [line] to the process as stdin. void writeLine(String line) { _schedule((_) => _processFuture.then( - (p) => p.stdin.add('$line\n'.charCodes))); + (p) => p.stdin.add('$line\n'.codeUnits))); } /// Kills the process, and waits until it's dead. -- GitLab