1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibJS: Replace Vector<u16> usage in PrimitiveString wth Utf16String

This commit does not go out of its way to reduce copying of the string
data yet, but is a minimum set of changes to compile LibJS after making
PrimitiveString hold a Utf16String.
This commit is contained in:
Timothy Flynn 2021-08-09 09:06:45 -04:00 committed by Andreas Kling
parent 02e7dceb96
commit c1e99fca1a
11 changed files with 80 additions and 87 deletions

View file

@ -13,6 +13,7 @@
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/StringConstructor.h>
#include <LibJS/Runtime/StringObject.h>
#include <LibJS/Runtime/Utf16String.h>
namespace JS {
@ -135,7 +136,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::from_char_code)
string.append(code_unit);
}
return js_string(vm, move(string));
return js_string(vm, Utf16String(move(string)));
}
// 22.1.2.2 String.fromCodePoint ( ...codePoints ), https://tc39.es/ecma262/#sec-string.fromcodepoint
@ -161,7 +162,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::from_code_point)
AK::code_point_to_utf16(string, static_cast<u32>(code_point));
}
return js_string(vm, move(string));
return js_string(vm, Utf16String(move(string)));
}
}