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

LibJS: Add ThrowCompletionOr versions of the JS native function macros

The old versions were renamed to JS_DECLARE_OLD_NATIVE_FUNCTION and
JS_DEFINE_OLD_NATIVE_FUNCTION, and will be eventually removed once all
native functions were converted to the new format.
This commit is contained in:
Idan Horowitz 2021-10-19 20:18:01 +03:00 committed by Linus Groh
parent 3355b52cca
commit 20163c0584
180 changed files with 1478 additions and 1472 deletions

View file

@ -67,7 +67,7 @@ Value StringConstructor::construct(FunctionObject& new_target)
}
// 22.1.2.4 String.raw ( template, ...substitutions ), https://tc39.es/ecma262/#sec-string.raw
JS_DEFINE_NATIVE_FUNCTION(StringConstructor::raw)
JS_DEFINE_OLD_NATIVE_FUNCTION(StringConstructor::raw)
{
auto* cooked = TRY_OR_DISCARD(vm.argument(0).to_object(global_object));
auto raw_value = TRY_OR_DISCARD(cooked->get(vm.names.raw));
@ -100,7 +100,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::raw)
}
// 22.1.2.1 String.fromCharCode ( ...codeUnits ), https://tc39.es/ecma262/#sec-string.fromcharcode
JS_DEFINE_NATIVE_FUNCTION(StringConstructor::from_char_code)
JS_DEFINE_OLD_NATIVE_FUNCTION(StringConstructor::from_char_code)
{
Vector<u16, 1> string;
string.ensure_capacity(vm.argument_count());
@ -112,7 +112,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::from_char_code)
}
// 22.1.2.2 String.fromCodePoint ( ...codePoints ), https://tc39.es/ecma262/#sec-string.fromcodepoint
JS_DEFINE_NATIVE_FUNCTION(StringConstructor::from_code_point)
JS_DEFINE_OLD_NATIVE_FUNCTION(StringConstructor::from_code_point)
{
Vector<u16, 1> string;
string.ensure_capacity(vm.argument_count()); // This will be an under-estimate if any code point is > 0xffff.