Chromium Code Reviews| Index: src/string.js |
| diff --git a/src/string.js b/src/string.js |
| index ae65264d4a3ae2c29cc39add829dd45e51ccf0c3..1f14ec3dc69c09f1ca85bb0db3c73c364e0c175a 100644 |
| --- a/src/string.js |
| +++ b/src/string.js |
| @@ -9,11 +9,12 @@ |
| // ------------------------------------------------------------------- |
| function StringConstructor(x) { |
| - var value = %_ArgumentsLength() == 0 ? '' : TO_STRING_INLINE(x); |
| if (%_IsConstructCall()) { |
| - %_SetValueOf(this, value); |
| + %_SetValueOf(this, %_ArgumentsLength() == 0 ? '' : TO_STRING_INLINE(x)); |
| } else { |
| - return value; |
| + if (%_ArgumentsLength() == 0) return ''; |
|
rossberg
2014/09/12 12:56:38
We could avoid duplicating this case by pulling ou
|
| + if (IS_SYMBOL(x)) return %_CallFunction(x, SymbolToString); |
| + return TO_STRING_INLINE(x); |
|
rossberg
2014/09/12 12:56:38
Nit: merge the returns into a ?:
|
| } |
| } |