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

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

Issue 23490008: Fix implementations of Match too, to use "input", not "str". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « runtime/lib/string_patch.dart ('k') | sdk/lib/_internal/lib/string_helper.dart » ('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 _js_helper; 5 part of _js_helper;
6 6
7 // Helper method used by internal libraries. 7 // Helper method used by internal libraries.
8 regExpGetNative(JSSyntaxRegExp regexp) => regexp._nativeRegExp; 8 regExpGetNative(JSSyntaxRegExp regexp) => regexp._nativeRegExp;
9 9
10 /** 10 /**
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 final Pattern pattern; 143 final Pattern pattern;
144 // Contains a JS RegExp match object. 144 // Contains a JS RegExp match object.
145 // It is an Array of String values with extra "index" and "input" properties. 145 // It is an Array of String values with extra "index" and "input" properties.
146 final List<String> _match; 146 final List<String> _match;
147 147
148 _MatchImplementation(this.pattern, this._match) { 148 _MatchImplementation(this.pattern, this._match) {
149 assert(JS("var", "#.input", _match) is String); 149 assert(JS("var", "#.input", _match) is String);
150 assert(JS("var", "#.index", _match) is int); 150 assert(JS("var", "#.index", _match) is int);
151 } 151 }
152 152
153 String get str => JS("String", "#.input", _match); 153 // TODO(12843): Remove when grace period is over.
154 String get str => input;
155 String get input => JS("String", "#.input", _match);
154 int get start => JS("int", "#.index", _match); 156 int get start => JS("int", "#.index", _match);
155 int get end => start + _match[0].length; 157 int get end => start + _match[0].length;
156 158
157 String group(int index) => _match[index]; 159 String group(int index) => _match[index];
158 String operator [](int index) => group(index); 160 String operator [](int index) => group(index);
159 int get groupCount => _match.length - 1; 161 int get groupCount => _match.length - 1;
160 162
161 List<String> groups(List<int> groups) { 163 List<String> groups(List<int> groups) {
162 List<String> out = []; 164 List<String> out = [];
163 for (int i in groups) { 165 for (int i in groups) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 return false; 202 return false;
201 } 203 }
202 return true; 204 return true;
203 } 205 }
204 } 206 }
205 207
206 /** Find the first match of [regExp] in [string] at or after [start]. */ 208 /** Find the first match of [regExp] in [string] at or after [start]. */
207 Match firstMatchAfter(JSSyntaxRegExp regExp, String string, int start) { 209 Match firstMatchAfter(JSSyntaxRegExp regExp, String string, int start) {
208 return regExp._execGlobal(string, start); 210 return regExp._execGlobal(string, start);
209 } 211 }
OLDNEW
« no previous file with comments | « runtime/lib/string_patch.dart ('k') | sdk/lib/_internal/lib/string_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698