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

Side by Side Diff: runtime/lib/regexp_patch.dart

Issue 11275042: Renaming IndexOutOfRangeException to RangeError. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Regenerated html files. 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
« no previous file with comments | « runtime/lib/growable_array.dart ('k') | runtime/lib/string.cc » ('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 class _JSRegExpMatch implements Match { 5 class _JSRegExpMatch implements Match {
6 _JSRegExpMatch(this.regexp, this.str, this._match); 6 _JSRegExpMatch(this.regexp, this.str, this._match);
7 7
8 int get start => _start(0); 8 int get start => _start(0);
9 int get end => _end(0); 9 int get end => _end(0);
10 10
11 int _start(int groupIdx) { 11 int _start(int groupIdx) {
12 return _match[(groupIdx * MATCH_PAIR)]; 12 return _match[(groupIdx * MATCH_PAIR)];
13 } 13 }
14 14
15 int _end(int groupIdx) { 15 int _end(int groupIdx) {
16 return _match[(groupIdx * MATCH_PAIR) + 1]; 16 return _match[(groupIdx * MATCH_PAIR) + 1];
17 } 17 }
18 18
19 String group(int groupIdx) { 19 String group(int groupIdx) {
20 if (groupIdx < 0 || groupIdx > regexp._groupCount) { 20 if (groupIdx < 0 || groupIdx > regexp._groupCount) {
21 throw new IndexOutOfRangeException(groupIdx); 21 throw new RangeError.value(groupIdx);
22 } 22 }
23 int startIndex = _start(groupIdx); 23 int startIndex = _start(groupIdx);
24 int endIndex = _end(groupIdx); 24 int endIndex = _end(groupIdx);
25 if (startIndex == -1) { 25 if (startIndex == -1) {
26 assert(endIndex == -1); 26 assert(endIndex == -1);
27 return null; 27 return null;
28 } 28 }
29 // TODO(ajohnsen): Use _substringUnchecked when regexp is in core. 29 // TODO(ajohnsen): Use _substringUnchecked when regexp is in core.
30 return str.substring(startIndex, endIndex); 30 return str.substring(startIndex, endIndex);
31 } 31 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 /* patch */ bool get multiLine native "JSSyntaxRegExp_multiLine"; 108 /* patch */ bool get multiLine native "JSSyntaxRegExp_multiLine";
109 109
110 /* patch */ bool get ignoreCase native "JSSyntaxRegExp_ignoreCase"; 110 /* patch */ bool get ignoreCase native "JSSyntaxRegExp_ignoreCase";
111 111
112 int get _groupCount native "JSSyntaxRegExp_getGroupCount"; 112 int get _groupCount native "JSSyntaxRegExp_getGroupCount";
113 113
114 List _ExecuteMatch(String str, int start_index) 114 List _ExecuteMatch(String str, int start_index)
115 native "JSSyntaxRegExp_ExecuteMatch"; 115 native "JSSyntaxRegExp_ExecuteMatch";
116 } 116 }
OLDNEW
« no previous file with comments | « runtime/lib/growable_array.dart ('k') | runtime/lib/string.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698