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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/lib/regexp_helper.dart

Issue 11363252: Extend Iterable instead of implementing it. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Address Stephen's comments. Created 8 years, 1 month 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 | Annotate | Revision Log
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 List regExpExec(JSSyntaxRegExp regExp, String str) { 5 List regExpExec(JSSyntaxRegExp regExp, String str) {
6 var nativeRegExp = regExpGetNative(regExp); 6 var nativeRegExp = regExpGetNative(regExp);
7 var result = JS('List', r'#.exec(#)', nativeRegExp, str); 7 var result = JS('List', r'#.exec(#)', nativeRegExp, str);
8 if (JS('bool', r'# == null', result)) return null; 8 if (JS('bool', r'# == null', result)) return null;
9 return result; 9 return result;
10 } 10 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 List<String> groups(List<int> groups) { 114 List<String> groups(List<int> groups) {
115 List<String> out = []; 115 List<String> out = [];
116 for (int i in groups) { 116 for (int i in groups) {
117 out.add(group(i)); 117 out.add(group(i));
118 } 118 }
119 return out; 119 return out;
120 } 120 }
121 } 121 }
122 122
123 class _AllMatchesIterable implements Iterable<Match> { 123 class _AllMatchesIterable extends Iterable<Match> {
124 final JSSyntaxRegExp _re; 124 final JSSyntaxRegExp _re;
125 final String _str; 125 final String _str;
126 126
127 const _AllMatchesIterable(this._re, this._str); 127 const _AllMatchesIterable(this._re, this._str);
128 128
129 Iterator<Match> iterator() => new _AllMatchesIterator(_re, _str); 129 Iterator<Match> iterator() => new _AllMatchesIterator(_re, _str);
130 } 130 }
131 131
132 class _AllMatchesIterator implements Iterator<Match> { 132 class _AllMatchesIterator implements Iterator<Match> {
133 final RegExp _re; 133 final RegExp _re;
(...skipping 26 matching lines...) Expand all
160 // hidden global flag. 160 // hidden global flag.
161 _next = _re.firstMatch(_str); 161 _next = _re.firstMatch(_str);
162 if (_next == null) { 162 if (_next == null) {
163 _done = true; 163 _done = true;
164 return false; 164 return false;
165 } else { 165 } else {
166 return true; 166 return true;
167 } 167 }
168 } 168 }
169 } 169 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart » ('j') | sdk/lib/utf/utf16.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698