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

Unified Diff: src/string.js

Issue 3181: Clean up some naming. (Closed)
Patch Set: Drop all changes except naming cleanup. Created 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/string.js
diff --git a/src/string.js b/src/string.js
index d8105fdfc0b88ffaa02a0e8ec110559a4c3b79a4..9b8670cf2640eb0f9387c4c8be2c88653aee827d 100644
--- a/src/string.js
+++ b/src/string.js
@@ -331,18 +331,19 @@ function ApplyReplacementFunction(replace, captures, subject) {
// ECMA-262 section 15.5.4.7
%AddProperty($String.prototype, "indexOf", function(searchString /* position */) { // length == 1
- var str = ToString(this);
- var str_len = str.length;
- var searchStr = ToString(searchString);
+ var subject_str = ToString(this);
+ var pattern_str = ToString(searchString);
+ var subject_str_len = subject_str.length;
+ var pattern_str_len = pattern_str.length;
var index = 0;
if (%_ArgumentsLength() > 1) {
var arg1 = %_Arguments(1); // position
index = TO_INTEGER(arg1);
}
if (index < 0) index = 0;
- if (index > str_len) index = str_len;
- if (searchStr.length + index > str_len) return -1;
- return %StringIndexOf(str, searchStr, index);
+ if (index > subject_str_len) index = subject_str_len;
+ if (pattern_str_len + index > subject_str_len) return -1;
+ return %StringIndexOf(subject_str, pattern_str, index);
}, DONT_ENUM);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698