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

Unified Diff: pkg/matcher/lib/src/utils.dart

Issue 317733006: pkg/matcher: reapply 36881,36896 working around Issue 19173 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: nit Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/matcher/lib/src/string_matchers.dart ('k') | pkg/matcher/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/matcher/lib/src/utils.dart
diff --git a/pkg/matcher/lib/src/utils.dart b/pkg/matcher/lib/src/utils.dart
deleted file mode 100644
index c2182c28949b1755d44efea4be99e9dc61befea0..0000000000000000000000000000000000000000
--- a/pkg/matcher/lib/src/utils.dart
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library matcher.utils;
-
-/**
- * Returns the name of the type of [x], or "Unknown" if the type name can't be
- * determined.
- */
-String typeName(x) {
- // dart2js blows up on some objects (e.g. window.navigator).
- // So we play safe here.
- try {
- if (x == null) return "null";
- var type = x.runtimeType.toString();
- // TODO(nweiz): if the object's type is private, find a public superclass to
- // display once there's a portable API to do that.
- return type.startsWith("_") ? "?" : type;
- } catch (e) {
- return "?";
- }
-}
-
-/**
- * Returns [source] with any control characters replaced by their escape
- * sequences.
- *
- * This doesn't add quotes to the string, but it does escape single quote
- * characters so that single quotes can be applied externally.
- */
-String escapeString(String source) =>
- source.split("").map(_escapeChar).join("");
-
-/** Return the escaped form of a character [ch]. */
-String _escapeChar(String ch) {
- if (ch == "'")
- return "\\'";
- else if (ch == '\n')
- return '\\n';
- else if (ch == '\r')
- return '\\r';
- else if (ch == '\t')
- return '\\t';
- else
- return ch;
-}
-
-/** Indent each line in [str] by two spaces. */
-String indent(String str) =>
- str.replaceAll(new RegExp("^", multiLine: true), " ");
-
-/** A pair of values. */
-class Pair<E, F> {
- E first;
- F last;
-
- Pair(this.first, this.last);
-
- String toString() => '($first, $last)';
-
- bool operator ==(other) {
- if (other is! Pair) return false;
- return other.first == first && other.last == last;
- }
-
- int get hashCode => first.hashCode ^ last.hashCode;
-}
-
« no previous file with comments | « pkg/matcher/lib/src/string_matchers.dart ('k') | pkg/matcher/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698