OLD | NEW |
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 // Generic utility functions. | 5 // Generic utility functions. |
6 library utils; | 6 library utils; |
7 | 7 |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 import 'dart:math' as math; | 9 import 'dart:math' as math; |
10 | 10 |
11 import 'package:pathos/path.dart' as pathos; | 11 import 'package:path/path.dart' as pathos; |
12 | 12 |
13 import '../../../../compiler/implementation/mirrors/mirrors.dart'; | 13 import '../../../../compiler/implementation/mirrors/mirrors.dart'; |
14 | 14 |
15 import '../export_map.dart'; | 15 import '../export_map.dart'; |
16 | 16 |
17 /** Turns [name] into something that's safe to use as a file name. */ | 17 /** Turns [name] into something that's safe to use as a file name. */ |
18 String sanitize(String name) => name.replaceAll(':', '_').replaceAll('/', '_'); | 18 String sanitize(String name) => name.replaceAll(':', '_').replaceAll('/', '_'); |
19 | 19 |
20 /** Returns the number of times [search] occurs in [text]. */ | 20 /** Returns the number of times [search] occurs in [text]. */ |
21 int countOccurrences(String text, String search) { | 21 int countOccurrences(String text, String search) { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 String toString() => '($first, $last)'; | 133 String toString() => '($first, $last)'; |
134 | 134 |
135 bool operator==(other) { | 135 bool operator==(other) { |
136 if (other is! Pair) return false; | 136 if (other is! Pair) return false; |
137 return other.first == first && other.last == last; | 137 return other.first == first && other.last == last; |
138 } | 138 } |
139 | 139 |
140 int get hashCode => first.hashCode ^ last.hashCode; | 140 int get hashCode => first.hashCode ^ last.hashCode; |
141 } | 141 } |
OLD | NEW |