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

Unified Diff: src/string.js

Issue 400583002: Change String.prototype.concat to be more like similar functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 9719df4c288f2a53af851574fda85180fa0b27e8..0d5ed0fc4297c49b0f79917de5a9e6b6a2758c4d 100644
--- a/src/string.js
+++ b/src/string.js
@@ -61,13 +61,13 @@ function StringCharCodeAt(pos) {
// ECMA-262, section 15.5.4.6
-function StringConcat() {
+function StringConcat(other /* and more */) { // length == 1
CHECK_OBJECT_COERCIBLE(this, "String.prototype.concat");
var len = %_ArgumentsLength();
var this_as_string = TO_STRING_INLINE(this);
if (len === 1) {
- return this_as_string + %_Arguments(0);
+ return this_as_string + other;
}
var parts = new InternalArray(len + 1);
parts[0] = this_as_string;
@@ -78,9 +78,6 @@ function StringConcat() {
return %StringBuilderConcat(parts, len + 1, "");
}
-// Match ES3 and Safari
-%FunctionSetLength(StringConcat, 1);
-
// ECMA-262 section 15.5.4.7
function StringIndexOfJS(pattern /* position */) { // length == 1
« 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