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

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

Issue 9692068: Fixed some static type warnings in vm core libraries (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged up Created 8 years, 9 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/immutable_map.dart ('k') | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 start() { 8 int start() {
9 return _start(0); 9 return _start(0);
10 } 10 }
11 11
12 int end() { 12 int end() {
13 return _end(0); 13 return _end(0);
14 } 14 }
15 15
16 int _start(int group) { 16 int _start(int groupIdx) {
17 return _match[(group * MATCH_PAIR)]; 17 return _match[(groupIdx * MATCH_PAIR)];
18 } 18 }
19 19
20 int _end(int group) { 20 int _end(int groupIdx) {
21 return _match[(group * MATCH_PAIR) + 1]; 21 return _match[(groupIdx * MATCH_PAIR) + 1];
22 } 22 }
23 23
24 String group(int group) { 24 String group(int groupIdx) {
25 if (group < 0 || group > regexp._groupCount) { 25 if (groupIdx < 0 || groupIdx > regexp._groupCount) {
26 throw new IndexOutOfRangeException(group); 26 throw new IndexOutOfRangeException(groupIdx);
27 } 27 }
28 int startIndex = _start(group); 28 int startIndex = _start(groupIdx);
29 int endIndex = _end(group); 29 int endIndex = _end(groupIdx);
30 if (startIndex == -1) { 30 if (startIndex == -1) {
31 assert(endIndex == -1); 31 assert(endIndex == -1);
32 return null; 32 return null;
33 } 33 }
34 return str.substringUnchecked_(startIndex, endIndex); 34 return str.substringUnchecked_(startIndex, endIndex);
35 } 35 }
36 36
37 String operator [](int group) { 37 String operator [](int groupIdx) {
38 return this.group(group); 38 return this.group(groupIdx);
39 } 39 }
40 40
41 List<String> groups(List<int> groups) { 41 List<String> groups(List<int> groupsSpec) {
42 var groupsList = new List<String>(groups.length); 42 var groupsList = new List<String>(groupsSpec.length);
43 for (int i = 0; i < groups.length; i++) { 43 for (int i = 0; i < groupsSpec.length; i++) {
44 groupsList[i] = group(groups[i]); 44 groupsList[i] = group(groupsSpec[i]);
45 } 45 }
46 return groupsList; 46 return groupsList;
47 } 47 }
48 48
49 int groupCount() { 49 int groupCount() {
50 return regexp._groupCount; 50 return regexp._groupCount;
51 } 51 }
52 52
53 final RegExp regexp; 53 final RegExp regexp;
54 final String str; 54 final String str;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 bool get multiLine() native "JSSyntaxRegExp_multiLine"; 111 bool get multiLine() native "JSSyntaxRegExp_multiLine";
112 112
113 bool get ignoreCase() native "JSSyntaxRegExp_ignoreCase"; 113 bool get ignoreCase() native "JSSyntaxRegExp_ignoreCase";
114 114
115 int get _groupCount() native "JSSyntaxRegExp_getGroupCount"; 115 int get _groupCount() native "JSSyntaxRegExp_getGroupCount";
116 116
117 List _ExecuteMatch(String str, int start_index) 117 List _ExecuteMatch(String str, int start_index)
118 native "JSSyntaxRegExp_ExecuteMatch"; 118 native "JSSyntaxRegExp_ExecuteMatch";
119 } 119 }
OLDNEW
« no previous file with comments | « runtime/lib/immutable_map.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698