- return Local<Unknown>(m_exec->globalData(), jsNull());
-
- return Local<Unknown>(m_exec->globalData(), jsString(m_exec, result.toUString()));
-}
-
-template <typename CharType>
-static void appendStringToUStringBuilder(UStringBuilder& builder, const CharType* data, int length)
-{
- for (int i = 0; i < length; ++i) {
- int start = i;
- while (i < length && (data[i] > 0x1F && data[i] != '"' && data[i] != '\\'))
- ++i;
- builder.append(data + start, i - start);
- if (i >= length)
- break;
- switch (data[i]) {
- case '\t':
- builder.append('\\');
- builder.append('t');
- break;
- case '\r':
- builder.append('\\');
- builder.append('r');
- break;
- case '\n':
- builder.append('\\');
- builder.append('n');
- break;
- case '\f':
- builder.append('\\');
- builder.append('f');
- break;
- case '\b':
- builder.append('\\');
- builder.append('b');
- break;
- case '"':
- builder.append('\\');
- builder.append('"');
- break;
- case '\\':
- builder.append('\\');
- builder.append('\\');
- break;
- default:
- static const char hexDigits[] = "0123456789abcdef";
- UChar ch = data[i];
- LChar hex[] = { '\\', 'u', hexDigits[(ch >> 12) & 0xF], hexDigits[(ch >> 8) & 0xF], hexDigits[(ch >> 4) & 0xF], hexDigits[ch & 0xF] };
- builder.append(hex, WTF_ARRAY_LENGTH(hex));
- break;
- }
- }
-}
-
-void Stringifier::appendQuotedString(UStringBuilder& builder, const UString& value)
-{
- int length = value.length();
-
- builder.append('"');
-
- if (value.is8Bit())
- appendStringToUStringBuilder<LChar>(builder, value.characters8(), length);
- else
- appendStringToUStringBuilder<UChar>(builder, value.characters16(), length);