Chromium Code Reviews

Unified Diff: src/string.js

Issue 1528005: Fix bug in string replace regexp with function when returning non-string. (Closed)
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | test/mjsunit/string-replace.js » ('j') | 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 f4489efa12182262b748d15ee6863b1eb357ecbd..b04c0c57fa3b774884761514229c84839d692028 100644
--- a/src/string.js
+++ b/src/string.js
@@ -450,9 +450,9 @@ function StringReplaceRegExpWithFunction(subject, regexp, replace) {
}
} else {
var func_result = replace.call(null, elem, match_start, subject);
- if (!IS_STRING(func_result)) func_result = TO_STRING(func_result);
+ if (!IS_STRING(func_result)) func_result = NonStringToString(func_result);
fschneider 2010/03/29 16:21:47 Long line.
Vitaly Repeshko 2010/03/29 16:52:53 You can use func_result = TO_STRING_INLINE(func_re
Lasse Reichstein 2010/03/29 18:58:31 Line wrapped. Re. TO_STRING_INLINE, I considered i
res[i] = func_result;
- match_start += elem.length;
+ match_start += elem.length;
}
i++;
}
@@ -464,7 +464,7 @@ function StringReplaceRegExpWithFunction(subject, regexp, replace) {
// Use the apply argument as backing for global RegExp properties.
lastMatchInfoOverride = elem;
var func_result = replace.apply(null, elem);
- if (!IS_STRING(func_result)) func_result = TO_STRING(func_result);
+ if (!IS_STRING(func_result)) func_result = NonStringToString(func_result);
fschneider 2010/03/29 16:21:47 Long line.
Vitaly Repeshko 2010/03/29 16:52:53 Same here.
Lasse Reichstein 2010/03/29 18:58:31 Dittos.
res[i] = func_result;
}
i++;
« no previous file with comments | « no previous file | test/mjsunit/string-replace.js » ('j') | no next file with comments »

Powered by Google App Engine