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

Side by Side Diff: src/string.js

Issue 48061: Remapped regexp last-match-info to put subject and index before match indices. (Closed)
Patch Set: Created 11 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 229
230 return builder.generate(); 230 return builder.generate();
231 } 231 }
232 232
233 233
234 // This has the same size as the lastMatchInfo array, and can be used for 234 // This has the same size as the lastMatchInfo array, and can be used for
235 // functions that expect that structure to be returned. It is used when the 235 // functions that expect that structure to be returned. It is used when the
236 // needle is a string rather than a regexp. In this case we can't update 236 // needle is a string rather than a regexp. In this case we can't update
237 // lastMatchArray without erroneously affecting the properties on the global 237 // lastMatchArray without erroneously affecting the properties on the global
238 // RegExp object. 238 // RegExp object.
239 var reusableMatchInfo = [2, -1, -1, "", ""]; 239 var reusableMatchInfo = [2, "", "", -1, -1];
240 240
241 241
242 // Helper function for regular expressions in String.prototype.replace. 242 // Helper function for regular expressions in String.prototype.replace.
243 function StringReplaceRegExp(subject, regexp, replace) { 243 function StringReplaceRegExp(subject, regexp, replace) {
244 replace = ToString(replace); 244 replace = ToString(replace);
245 return %StringReplaceRegExpWithString(subject, 245 return %StringReplaceRegExpWithString(subject,
246 regexp, 246 regexp,
247 replace, 247 replace,
248 lastMatchInfo); 248 lastMatchInfo);
249 }; 249 };
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 "italics", StringItalics, 868 "italics", StringItalics,
869 "small", StringSmall, 869 "small", StringSmall,
870 "strike", StringStrike, 870 "strike", StringStrike,
871 "sub", StringSub, 871 "sub", StringSub,
872 "sup", StringSup 872 "sup", StringSup
873 )); 873 ));
874 } 874 }
875 875
876 876
877 SetupString(); 877 SetupString();
OLDNEW
« src/regexp-delay.js ('K') | « src/regexp-delay.js ('k') | src/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698