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

Side by Side Diff: tool/input_sdk/private/string_helper.dart

Issue 1948113003: Upgrade Iterable and Iterator. (Closed) Base URL: https://github.com/dart-lang/dev_compiler@master
Patch Set: Created 4 years, 7 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 | « tool/input_sdk/lib/internal/iterable.dart ('k') | tool/sdk_expected_errors.txt » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of dart._js_helper; 5 part of dart._js_helper;
6 6
7 int stringIndexOfStringUnchecked(receiver, other, startIndex) { 7 int stringIndexOfStringUnchecked(receiver, other, startIndex) {
8 return JS('int', '#.indexOf(#, #)', receiver, other, startIndex); 8 return JS('int', '#.indexOf(#, #)', receiver, other, startIndex);
9 } 9 }
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 final int start; 47 final int start;
48 final String input; 48 final String input;
49 final String pattern; 49 final String pattern;
50 } 50 }
51 51
52 Iterable<Match> allMatchesInStringUnchecked(String pattern, String string, 52 Iterable<Match> allMatchesInStringUnchecked(String pattern, String string,
53 int startIndex) { 53 int startIndex) {
54 return new _StringAllMatchesIterable(string, pattern, startIndex); 54 return new _StringAllMatchesIterable(string, pattern, startIndex);
55 } 55 }
56 56
57 class _StringAllMatchesIterable extends IterableBase<Match> { 57 class _StringAllMatchesIterable extends Iterable<Match> {
58 final String _input; 58 final String _input;
59 final String _pattern; 59 final String _pattern;
60 final int _index; 60 final int _index;
61 61
62 _StringAllMatchesIterable(this._input, this._pattern, this._index); 62 _StringAllMatchesIterable(this._input, this._pattern, this._index);
63 63
64 Iterator<Match> get iterator => 64 Iterator<Match> get iterator =>
65 new _StringAllMatchesIterator(_input, _pattern, _index); 65 new _StringAllMatchesIterator(_input, _pattern, _index);
66 66
67 Match get first { 67 Match get first {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 String stringJoinUnchecked(array, separator) { 292 String stringJoinUnchecked(array, separator) {
293 return JS('String', r'#.join(#)', array, separator); 293 return JS('String', r'#.join(#)', array, separator);
294 } 294 }
295 295
296 String stringReplaceRangeUnchecked(String receiver, 296 String stringReplaceRangeUnchecked(String receiver,
297 int start, int end, String replacement) { 297 int start, int end, String replacement) {
298 var prefix = JS('String', '#.substring(0, #)', receiver, start); 298 var prefix = JS('String', '#.substring(0, #)', receiver, start);
299 var suffix = JS('String', '#.substring(#)', receiver, end); 299 var suffix = JS('String', '#.substring(#)', receiver, end);
300 return "$prefix$replacement$suffix"; 300 return "$prefix$replacement$suffix";
301 } 301 }
OLDNEW
« no previous file with comments | « tool/input_sdk/lib/internal/iterable.dart ('k') | tool/sdk_expected_errors.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698