mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +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:
parent
3355b52cca
commit
20163c0584
Notes:
sideshowbarker
2024-07-18 02:08:55 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/20163c05848 Pull-request: https://github.com/SerenityOS/serenity/pull/10543 Reviewed-by: https://github.com/linusg
180 changed files with 1478 additions and 1472 deletions
|
@ -125,7 +125,7 @@ public:
|
|||
virtual void initialize_global_object() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(fuzzilli);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(fuzzilli);
|
||||
};
|
||||
|
||||
TestRunnerGlobalObject::TestRunnerGlobalObject()
|
||||
|
@ -136,7 +136,7 @@ TestRunnerGlobalObject::~TestRunnerGlobalObject()
|
|||
{
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(TestRunnerGlobalObject::fuzzilli)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(TestRunnerGlobalObject::fuzzilli)
|
||||
{
|
||||
if (!vm.argument_count())
|
||||
return JS::js_undefined();
|
||||
|
|
|
@ -1435,7 +1435,7 @@ static void generate_function(SourceGenerator& generator, IDL::Function const& f
|
|||
}
|
||||
|
||||
function_generator.append(R"~~~(
|
||||
JS_DEFINE_NATIVE_FUNCTION(@class_name@::@function.name:snakecase@)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(@class_name@::@function.name:snakecase@)
|
||||
{
|
||||
)~~~");
|
||||
|
||||
|
@ -2551,7 +2551,7 @@ private:
|
|||
auto function_generator = generator.fork();
|
||||
function_generator.set("function.name:snakecase", make_input_acceptable_cpp(function.name.to_snakecase()));
|
||||
function_generator.append(R"~~~(
|
||||
JS_DECLARE_NATIVE_FUNCTION(@function.name:snakecase@);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(@function.name:snakecase@);
|
||||
)~~~");
|
||||
}
|
||||
|
||||
|
@ -2782,24 +2782,24 @@ private:
|
|||
auto function_generator = generator.fork();
|
||||
function_generator.set("function.name:snakecase", make_input_acceptable_cpp(function.name.to_snakecase()));
|
||||
function_generator.append(R"~~~(
|
||||
JS_DECLARE_NATIVE_FUNCTION(@function.name:snakecase@);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(@function.name:snakecase@);
|
||||
)~~~");
|
||||
}
|
||||
|
||||
if (interface.has_stringifier) {
|
||||
auto stringifier_generator = generator.fork();
|
||||
stringifier_generator.append(R"~~~(
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_string);
|
||||
)~~~");
|
||||
}
|
||||
|
||||
if (interface.pair_iterator_types.has_value()) {
|
||||
auto iterator_generator = generator.fork();
|
||||
iterator_generator.append(R"~~~(
|
||||
JS_DECLARE_NATIVE_FUNCTION(entries);
|
||||
JS_DECLARE_NATIVE_FUNCTION(for_each);
|
||||
JS_DECLARE_NATIVE_FUNCTION(keys);
|
||||
JS_DECLARE_NATIVE_FUNCTION(values);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(entries);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(for_each);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(keys);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(values);
|
||||
)~~~");
|
||||
}
|
||||
|
||||
|
@ -2807,12 +2807,12 @@ private:
|
|||
auto attribute_generator = generator.fork();
|
||||
attribute_generator.set("attribute.name:snakecase", attribute.name.to_snakecase());
|
||||
attribute_generator.append(R"~~~(
|
||||
JS_DECLARE_NATIVE_FUNCTION(@attribute.name:snakecase@_getter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(@attribute.name:snakecase@_getter);
|
||||
)~~~");
|
||||
|
||||
if (!attribute.readonly) {
|
||||
attribute_generator.append(R"~~~(
|
||||
JS_DECLARE_NATIVE_FUNCTION(@attribute.name:snakecase@_setter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(@attribute.name:snakecase@_setter);
|
||||
)~~~");
|
||||
}
|
||||
}
|
||||
|
@ -3189,7 +3189,7 @@ static @fully_qualified_name@* impl_from(JS::VM& vm, JS::GlobalObject& global_ob
|
|||
}
|
||||
|
||||
attribute_generator.append(R"~~~(
|
||||
JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::@attribute.getter_callback@)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(@prototype_class@::@attribute.getter_callback@)
|
||||
{
|
||||
auto* impl = impl_from(vm, global_object);
|
||||
if (!impl)
|
||||
|
@ -3227,7 +3227,7 @@ JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::@attribute.getter_callback@)
|
|||
|
||||
if (!attribute.readonly) {
|
||||
attribute_generator.append(R"~~~(
|
||||
JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::@attribute.setter_callback@)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(@prototype_class@::@attribute.setter_callback@)
|
||||
{
|
||||
auto* impl = impl_from(vm, global_object);
|
||||
if (!impl)
|
||||
|
@ -3279,7 +3279,7 @@ JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::@attribute.setter_callback@)
|
|||
stringifier_generator.set("attribute.cpp_getter_name", interface.stringifier_attribute->to_snakecase());
|
||||
|
||||
stringifier_generator.append(R"~~~(
|
||||
JS_DEFINE_NATIVE_FUNCTION(@class_name@::to_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(@class_name@::to_string)
|
||||
{
|
||||
auto* impl = impl_from(vm, global_object);
|
||||
if (!impl)
|
||||
|
@ -3310,7 +3310,7 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::to_string)
|
|||
if (interface.pair_iterator_types.has_value()) {
|
||||
auto iterator_generator = generator.fork();
|
||||
iterator_generator.append(R"~~~(
|
||||
JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::entries)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(@prototype_class@::entries)
|
||||
{
|
||||
auto* impl = impl_from(vm, global_object);
|
||||
if (!impl)
|
||||
|
@ -3319,7 +3319,7 @@ JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::entries)
|
|||
return wrap(global_object, @iterator_name@::create(*impl, Object::PropertyKind::KeyAndValue));
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::for_each)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(@prototype_class@::for_each)
|
||||
{
|
||||
auto* impl = impl_from(vm, global_object);
|
||||
if (!impl)
|
||||
|
@ -3346,7 +3346,7 @@ JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::for_each)
|
|||
return JS::js_undefined();
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::keys)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(@prototype_class@::keys)
|
||||
{
|
||||
auto* impl = impl_from(vm, global_object);
|
||||
if (!impl)
|
||||
|
@ -3355,7 +3355,7 @@ JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::keys)
|
|||
return wrap(global_object, @iterator_name@::create(*impl, Object::PropertyKind::Key));
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::values)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(@prototype_class@::values)
|
||||
{
|
||||
auto* impl = impl_from(vm, global_object);
|
||||
if (!impl)
|
||||
|
@ -3545,7 +3545,7 @@ public:
|
|||
virtual ~@prototype_class@() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(next);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(next);
|
||||
};
|
||||
|
||||
} // namespace Web::Bindings
|
||||
|
@ -3652,7 +3652,7 @@ static @fully_qualified_name@* impl_from(JS::VM& vm, JS::GlobalObject& global_ob
|
|||
return &static_cast<@wrapper_class@*>(this_object)->impl();
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::next)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(@prototype_class@::next)
|
||||
{
|
||||
auto* impl = impl_from(vm, global_object);
|
||||
if (!impl)
|
||||
|
|
|
@ -62,8 +62,8 @@ public:
|
|||
~WebAssemblyModule() override = default;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_export);
|
||||
JS_DECLARE_NATIVE_FUNCTION(wasm_invoke);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_export);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(wasm_invoke);
|
||||
|
||||
static HashMap<Wasm::Linker::Name, Wasm::ExternValue> const& spec_test_namespace()
|
||||
{
|
||||
|
@ -159,7 +159,7 @@ void WebAssemblyModule::initialize(JS::GlobalObject& global_object)
|
|||
define_native_function("invoke", wasm_invoke, 1, JS::default_attributes);
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::get_export)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(WebAssemblyModule::get_export)
|
||||
{
|
||||
auto name = TRY_OR_DISCARD(vm.argument(0).to_string(global_object));
|
||||
auto this_value = vm.this_value(global_object);
|
||||
|
@ -193,7 +193,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::get_export)
|
|||
return {};
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::wasm_invoke)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(WebAssemblyModule::wasm_invoke)
|
||||
{
|
||||
auto address = static_cast<unsigned long>(TRY_OR_DISCARD(vm.argument(0).to_double(global_object)));
|
||||
Wasm::FunctionAddress function_address { address };
|
||||
|
|
|
@ -169,7 +169,7 @@ void SheetGlobalObject::visit_edges(Visitor& visitor)
|
|||
}
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::get_real_cell_contents)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(SheetGlobalObject::get_real_cell_contents)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -206,7 +206,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::get_real_cell_contents)
|
|||
return JS::js_string(vm, cell->data());
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::set_real_cell_contents)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(SheetGlobalObject::set_real_cell_contents)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -245,7 +245,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::set_real_cell_contents)
|
|||
return JS::js_null();
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::parse_cell_name)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(SheetGlobalObject::parse_cell_name)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -276,7 +276,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::parse_cell_name)
|
|||
return object;
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::current_cell_position)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(SheetGlobalObject::current_cell_position)
|
||||
{
|
||||
if (vm.argument_count() != 0) {
|
||||
vm.throw_exception<JS::TypeError>(global_object, "Expected no arguments to current_cell_position()");
|
||||
|
@ -304,7 +304,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::current_cell_position)
|
|||
return object;
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::column_index)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(SheetGlobalObject::column_index)
|
||||
{
|
||||
if (vm.argument_count() != 1) {
|
||||
vm.throw_exception<JS::TypeError>(global_object, "Expected exactly one argument to column_index()");
|
||||
|
@ -337,7 +337,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::column_index)
|
|||
return JS::Value((i32)column_index.value());
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::column_arithmetic)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(SheetGlobalObject::column_arithmetic)
|
||||
{
|
||||
if (vm.argument_count() != 2) {
|
||||
vm.throw_exception<JS::TypeError>(global_object, "Expected exactly two arguments to column_arithmetic()");
|
||||
|
@ -397,7 +397,7 @@ void WorkbookObject::visit_edges(Visitor& visitor)
|
|||
visitor.visit(&sheet.global_object());
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(WorkbookObject::sheet)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(WorkbookObject::sheet)
|
||||
{
|
||||
if (vm.argument_count() != 1) {
|
||||
vm.throw_exception<JS::TypeError>(global_object, "Expected exactly one argument to sheet()");
|
||||
|
|
|
@ -32,12 +32,12 @@ public:
|
|||
virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyName const&, JS::Value value, JS::Value receiver) override;
|
||||
virtual void initialize_global_object() override;
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_real_cell_contents);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_real_cell_contents);
|
||||
JS_DECLARE_NATIVE_FUNCTION(parse_cell_name);
|
||||
JS_DECLARE_NATIVE_FUNCTION(current_cell_position);
|
||||
JS_DECLARE_NATIVE_FUNCTION(column_index);
|
||||
JS_DECLARE_NATIVE_FUNCTION(column_arithmetic);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_real_cell_contents);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_real_cell_contents);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(parse_cell_name);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(current_cell_position);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(column_index);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(column_arithmetic);
|
||||
|
||||
private:
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
@ -54,7 +54,7 @@ public:
|
|||
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(sheet);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(sheet);
|
||||
|
||||
private:
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
|
|
@ -6,12 +6,18 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define JS_DECLARE_NATIVE_FUNCTION(name) \
|
||||
#define JS_DECLARE_OLD_NATIVE_FUNCTION(name) \
|
||||
static JS::Value name(JS::VM&, JS::GlobalObject&)
|
||||
|
||||
#define JS_DEFINE_NATIVE_FUNCTION(name) \
|
||||
#define JS_DEFINE_OLD_NATIVE_FUNCTION(name) \
|
||||
JS::Value name([[maybe_unused]] JS::VM& vm, [[maybe_unused]] JS::GlobalObject& global_object)
|
||||
|
||||
#define JS_DECLARE_NATIVE_FUNCTION(name) \
|
||||
static JS::ThrowCompletionOr<JS::Value> name(JS::VM&, JS::GlobalObject&)
|
||||
|
||||
#define JS_DEFINE_NATIVE_FUNCTION(name) \
|
||||
JS::ThrowCompletionOr<JS::Value> name([[maybe_unused]] JS::VM& vm, [[maybe_unused]] JS::GlobalObject& global_object)
|
||||
|
||||
// NOTE: Proxy is not included here as it doesn't have a prototype - m_proxy_constructor is initialized separately.
|
||||
#define JS_ENUMERATE_NATIVE_OBJECTS_EXCLUDING_TEMPLATES \
|
||||
__JS_ENUMERATE(AggregateError, aggregate_error, AggregateErrorPrototype, AggregateErrorConstructor, void) \
|
||||
|
|
|
@ -65,7 +65,7 @@ Value ArrayBufferConstructor::construct(FunctionObject& new_target)
|
|||
}
|
||||
|
||||
// 25.1.4.1 ArrayBuffer.isView ( arg ), https://tc39.es/ecma262/#sec-arraybuffer.isview
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayBufferConstructor::is_view)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayBufferConstructor::is_view)
|
||||
{
|
||||
auto arg = vm.argument(0);
|
||||
if (!arg.is_object())
|
||||
|
@ -78,7 +78,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayBufferConstructor::is_view)
|
|||
}
|
||||
|
||||
// 25.1.4.3 get ArrayBuffer [ @@species ], https://tc39.es/ecma262/#sec-get-arraybuffer-@@species
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayBufferConstructor::symbol_species_getter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayBufferConstructor::symbol_species_getter)
|
||||
{
|
||||
return vm.this_value(global_object);
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@ public:
|
|||
private:
|
||||
virtual bool has_constructor() const override { return true; }
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(is_view);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(is_view);
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(symbol_species_getter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(symbol_species_getter);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ ArrayBufferPrototype::~ArrayBufferPrototype()
|
|||
}
|
||||
|
||||
// 25.1.5.3 ArrayBuffer.prototype.slice ( start, end ), https://tc39.es/ecma262/#sec-arraybuffer.prototype.slice
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayBufferPrototype::slice)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayBufferPrototype::slice)
|
||||
{
|
||||
auto* array_buffer_object = TRY_OR_DISCARD(typed_this_value(global_object));
|
||||
// FIXME: Check for shared buffer
|
||||
|
@ -103,7 +103,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayBufferPrototype::slice)
|
|||
}
|
||||
|
||||
// 25.1.5.1 get ArrayBuffer.prototype.byteLength, https://tc39.es/ecma262/#sec-get-arraybuffer.prototype.bytelength
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayBufferPrototype::byte_length_getter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayBufferPrototype::byte_length_getter)
|
||||
{
|
||||
auto* array_buffer_object = TRY_OR_DISCARD(typed_this_value(global_object));
|
||||
// FIXME: Check for shared buffer
|
||||
|
|
|
@ -20,8 +20,8 @@ public:
|
|||
virtual ~ArrayBufferPrototype() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(slice);
|
||||
JS_DECLARE_NATIVE_FUNCTION(byte_length_getter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(slice);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(byte_length_getter);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ Value ArrayConstructor::construct(FunctionObject& new_target)
|
|||
}
|
||||
|
||||
// 23.1.2.1 Array.from ( items [ , mapfn [ , thisArg ] ] ), https://tc39.es/ecma262/#sec-array.from
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::from)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayConstructor::from)
|
||||
{
|
||||
auto constructor = vm.this_value(global_object);
|
||||
|
||||
|
@ -200,14 +200,14 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::from)
|
|||
}
|
||||
|
||||
// 23.1.2.2 Array.isArray ( arg ), https://tc39.es/ecma262/#sec-array.isarray
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::is_array)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayConstructor::is_array)
|
||||
{
|
||||
auto value = vm.argument(0);
|
||||
return Value(TRY_OR_DISCARD(value.is_array(global_object)));
|
||||
}
|
||||
|
||||
// 23.1.2.3 Array.of ( ...items ), https://tc39.es/ecma262/#sec-array.of
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::of)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayConstructor::of)
|
||||
{
|
||||
auto this_value = vm.this_value(global_object);
|
||||
Value array;
|
||||
|
@ -230,7 +230,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::of)
|
|||
}
|
||||
|
||||
// 23.1.2.5 get Array [ @@species ], https://tc39.es/ecma262/#sec-get-array-@@species
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::symbol_species_getter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayConstructor::symbol_species_getter)
|
||||
{
|
||||
return vm.this_value(global_object);
|
||||
}
|
||||
|
|
|
@ -24,11 +24,11 @@ public:
|
|||
private:
|
||||
virtual bool has_constructor() const override { return true; }
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(from);
|
||||
JS_DECLARE_NATIVE_FUNCTION(is_array);
|
||||
JS_DECLARE_NATIVE_FUNCTION(of);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(from);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(is_array);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(of);
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(symbol_species_getter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(symbol_species_getter);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ ArrayIteratorPrototype::~ArrayIteratorPrototype()
|
|||
|
||||
// 23.1.5.2.1 %ArrayIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
|
||||
// FIXME: This seems to be CreateArrayIterator (https://tc39.es/ecma262/#sec-createarrayiterator) instead of %ArrayIteratorPrototype%.next.
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayIteratorPrototype::next)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayIteratorPrototype::next)
|
||||
{
|
||||
auto* iterator = TRY_OR_DISCARD(typed_this_value(global_object));
|
||||
auto target_array = iterator->array();
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
virtual ~ArrayIteratorPrototype() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(next);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(next);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ static Object* array_species_create(GlobalObject& global_object, Object& origina
|
|||
}
|
||||
|
||||
// 23.1.3.7 Array.prototype.filter ( callbackfn [ , thisArg ] ), https://tc39.es/ecma262/#sec-array.prototype.filter
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::filter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::filter)
|
||||
{
|
||||
auto callback_function = vm.argument(0);
|
||||
auto this_arg = vm.argument(1);
|
||||
|
@ -216,7 +216,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::filter)
|
|||
}
|
||||
|
||||
// 23.1.3.12 Array.prototype.forEach ( callbackfn [ , thisArg ] ), https://tc39.es/ecma262/#sec-array.prototype.foreach
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::for_each)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::for_each)
|
||||
{
|
||||
auto callback_function = vm.argument(0);
|
||||
auto this_arg = vm.argument(1);
|
||||
|
@ -261,7 +261,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::for_each)
|
|||
}
|
||||
|
||||
// 23.1.3.18 Array.prototype.map ( callbackfn [ , thisArg ] ), https://tc39.es/ecma262/#sec-array.prototype.map
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::map)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::map)
|
||||
{
|
||||
auto callback_function = vm.argument(0);
|
||||
auto this_arg = vm.argument(1);
|
||||
|
@ -312,7 +312,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::map)
|
|||
}
|
||||
|
||||
// 23.1.3.20 Array.prototype.push ( ...items ), https://tc39.es/ecma262/#sec-array.prototype.push
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::push)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::push)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
auto length = TRY_OR_DISCARD(length_of_array_like(global_object, *this_object));
|
||||
|
@ -330,7 +330,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::push)
|
|||
}
|
||||
|
||||
// 23.1.3.31 Array.prototype.unshift ( ...items ), https://tc39.es/ecma262/#sec-array.prototype.unshift
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::unshift)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::unshift)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
auto length = TRY_OR_DISCARD(length_of_array_like(global_object, *this_object));
|
||||
|
@ -364,7 +364,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::unshift)
|
|||
}
|
||||
|
||||
// 23.1.3.19 Array.prototype.pop ( ), https://tc39.es/ecma262/#sec-array.prototype.pop
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::pop)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::pop)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
auto length = TRY_OR_DISCARD(length_of_array_like(global_object, *this_object));
|
||||
|
@ -380,7 +380,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::pop)
|
|||
}
|
||||
|
||||
// 23.1.3.24 Array.prototype.shift ( ), https://tc39.es/ecma262/#sec-array.prototype.shift
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::shift)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::shift)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
auto length = TRY_OR_DISCARD(length_of_array_like(global_object, *this_object));
|
||||
|
@ -407,7 +407,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::shift)
|
|||
}
|
||||
|
||||
// 23.1.3.30 Array.prototype.toString ( ), https://tc39.es/ecma262/#sec-array.prototype.tostring
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::to_string)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
auto join_function = TRY_OR_DISCARD(this_object->get(vm.names.join));
|
||||
|
@ -417,7 +417,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_string)
|
|||
}
|
||||
|
||||
// 23.1.3.29 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ), https://tc39.es/ecma262/#sec-array.prototype.tolocalestring
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_locale_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::to_locale_string)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -446,7 +446,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_locale_string)
|
|||
}
|
||||
|
||||
// 23.1.3.15 Array.prototype.join ( separator ), https://tc39.es/ecma262/#sec-array.prototype.join
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::join)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::join)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -479,7 +479,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::join)
|
|||
}
|
||||
|
||||
// 23.1.3.1 Array.prototype.concat ( ...items ), https://tc39.es/ecma262/#sec-array.prototype.concat
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::concat)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::concat)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -563,7 +563,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::concat)
|
|||
}
|
||||
|
||||
// 23.1.3.25 Array.prototype.slice ( start, end ), https://tc39.es/ecma262/#sec-array.prototype.slice
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::slice)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::slice)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -621,7 +621,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::slice)
|
|||
}
|
||||
|
||||
// 23.1.3.14 Array.prototype.indexOf ( searchElement [ , fromIndex ] ), https://tc39.es/ecma262/#sec-array.prototype.indexof
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::index_of)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::index_of)
|
||||
{
|
||||
auto search_element = vm.argument(0);
|
||||
auto from_index = vm.argument(1);
|
||||
|
@ -693,7 +693,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::index_of)
|
|||
}
|
||||
|
||||
// 23.1.3.21 Array.prototype.reduce ( callbackfn [ , initialValue ] ), https://tc39.es/ecma262/#sec-array.prototype.reduce
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::reduce)
|
||||
{
|
||||
auto callback_function = vm.argument(0);
|
||||
auto initial_value = vm.argument(1);
|
||||
|
@ -781,7 +781,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce)
|
|||
}
|
||||
|
||||
// 23.1.3.22 Array.prototype.reduceRight ( callbackfn [ , initialValue ] ), https://tc39.es/ecma262/#sec-array.prototype.reduceright
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce_right)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::reduce_right)
|
||||
{
|
||||
auto callback_function = vm.argument(0);
|
||||
auto initial_value = vm.argument(1);
|
||||
|
@ -869,7 +869,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce_right)
|
|||
}
|
||||
|
||||
// 23.1.3.23 Array.prototype.reverse ( ), https://tc39.es/ecma262/#sec-array.prototype.reverse
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reverse)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::reverse)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
auto length = TRY_OR_DISCARD(length_of_array_like(global_object, *this_object));
|
||||
|
@ -1017,7 +1017,7 @@ static void array_merge_sort(VM& vm, GlobalObject& global_object, FunctionObject
|
|||
}
|
||||
|
||||
// 23.1.3.27 Array.prototype.sort ( comparefn ), https://tc39.es/ecma262/#sec-array.prototype.sort
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::sort)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::sort)
|
||||
{
|
||||
auto callback = vm.argument(0);
|
||||
if (!callback.is_undefined() && !callback.is_function()) {
|
||||
|
@ -1061,7 +1061,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::sort)
|
|||
}
|
||||
|
||||
// 23.1.3.17 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ), https://tc39.es/ecma262/#sec-array.prototype.lastindexof
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::last_index_of)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::last_index_of)
|
||||
{
|
||||
auto search_element = vm.argument(0);
|
||||
auto from_index = vm.argument(1);
|
||||
|
@ -1129,7 +1129,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::last_index_of)
|
|||
}
|
||||
|
||||
// 23.1.3.13 Array.prototype.includes ( searchElement [ , fromIndex ] ), https://tc39.es/ecma262/#sec-array.prototype.includes
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::includes)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::includes)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
auto length = TRY_OR_DISCARD(length_of_array_like(global_object, *this_object));
|
||||
|
@ -1160,7 +1160,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::includes)
|
|||
}
|
||||
|
||||
// 23.1.3.8 Array.prototype.find ( predicate [ , thisArg ] ), https://tc39.es/ecma262/#sec-array.prototype.find
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::find)
|
||||
{
|
||||
auto predicate = vm.argument(0);
|
||||
auto this_arg = vm.argument(1);
|
||||
|
@ -1201,7 +1201,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find)
|
|||
}
|
||||
|
||||
// 23.1.3.9 Array.prototype.findIndex ( predicate [ , thisArg ] ), https://tc39.es/ecma262/#sec-array.prototype.findindex
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find_index)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::find_index)
|
||||
{
|
||||
auto predicate = vm.argument(0);
|
||||
auto this_arg = vm.argument(1);
|
||||
|
@ -1242,7 +1242,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find_index)
|
|||
}
|
||||
|
||||
// 1 Array.prototype.findLast ( predicate [ , thisArg ] ), https://tc39.es/proposal-array-find-from-last/index.html#sec-array.prototype.findlast
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find_last)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::find_last)
|
||||
{
|
||||
auto predicate = vm.argument(0);
|
||||
auto this_arg = vm.argument(1);
|
||||
|
@ -1283,7 +1283,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find_last)
|
|||
}
|
||||
|
||||
// 2 Array.prototype.findLastIndex ( predicate [ , thisArg ] ), https://tc39.es/proposal-array-find-from-last/index.html#sec-array.prototype.findlastindex
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find_last_index)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::find_last_index)
|
||||
{
|
||||
auto predicate = vm.argument(0);
|
||||
auto this_arg = vm.argument(1);
|
||||
|
@ -1324,7 +1324,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find_last_index)
|
|||
}
|
||||
|
||||
// 23.1.3.26 Array.prototype.some ( callbackfn [ , thisArg ] ), https://tc39.es/ecma262/#sec-array.prototype.some
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::some)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::some)
|
||||
{
|
||||
auto callback_function = vm.argument(0);
|
||||
auto this_arg = vm.argument(1);
|
||||
|
@ -1371,7 +1371,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::some)
|
|||
}
|
||||
|
||||
// 23.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] ), https://tc39.es/ecma262/#sec-array.prototype.every
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::every)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::every)
|
||||
{
|
||||
auto callback_function = vm.argument(0);
|
||||
auto this_arg = vm.argument(1);
|
||||
|
@ -1418,7 +1418,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::every)
|
|||
}
|
||||
|
||||
// 23.1.3.28 Array.prototype.splice ( start, deleteCount, ...items ), https://tc39.es/ecma262#sec-array.prototype.splice
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::splice)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::splice)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -1514,7 +1514,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::splice)
|
|||
}
|
||||
|
||||
// 23.1.3.6 Array.prototype.fill ( value [ , start [ , end ] ] ), https://tc39.es/ecma262/#sec-array.prototype.fill
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::fill)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::fill)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -1555,7 +1555,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::fill)
|
|||
}
|
||||
|
||||
// 23.1.3.32 Array.prototype.values ( ), https://tc39.es/ecma262/#sec-array.prototype.values
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::values)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::values)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -1563,7 +1563,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::values)
|
|||
}
|
||||
|
||||
// 23.1.3.16 Array.prototype.entries ( ), https://tc39.es/ecma262/#sec-array.prototype.entries
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::entries)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::entries)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -1571,7 +1571,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::entries)
|
|||
}
|
||||
|
||||
// 23.1.3.16 Array.prototype.keys ( ), https://tc39.es/ecma262/#sec-array.prototype.keys
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::keys)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::keys)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -1620,7 +1620,7 @@ static size_t flatten_into_array(GlobalObject& global_object, Object& new_array,
|
|||
}
|
||||
|
||||
// 23.1.3.10 Array.prototype.flat ( [ depth ] ), https://tc39.es/ecma262/#sec-array.prototype.flat
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::flat)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::flat)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -1643,7 +1643,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::flat)
|
|||
}
|
||||
|
||||
// 23.1.3.11 Array.prototype.flatMap ( mapperFunction [ , thisArg ] ), https://tc39.es/ecma262/#sec-array.prototype.flatmap
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::flat_map)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::flat_map)
|
||||
{
|
||||
auto mapper_function = vm.argument(0);
|
||||
auto this_arg = vm.argument(1);
|
||||
|
@ -1675,7 +1675,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::flat_map)
|
|||
}
|
||||
|
||||
// 23.1.3.3 Array.prototype.copyWithin ( target, start [ , end ] ), https://tc39.es/ecma262/#sec-array.prototype.copywithin
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::copy_within)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::copy_within)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
auto length = TRY_OR_DISCARD(length_of_array_like(global_object, *this_object));
|
||||
|
@ -1741,7 +1741,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::copy_within)
|
|||
}
|
||||
|
||||
// 1.1 Array.prototype.at ( index ), https://tc39.es/proposal-relative-indexing-method/#sec-array.prototype.at
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::at)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ArrayPrototype::at)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
auto length = TRY_OR_DISCARD(length_of_array_like(global_object, *this_object));
|
||||
|
|
|
@ -20,40 +20,40 @@ public:
|
|||
virtual ~ArrayPrototype() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(filter);
|
||||
JS_DECLARE_NATIVE_FUNCTION(for_each);
|
||||
JS_DECLARE_NATIVE_FUNCTION(map);
|
||||
JS_DECLARE_NATIVE_FUNCTION(pop);
|
||||
JS_DECLARE_NATIVE_FUNCTION(push);
|
||||
JS_DECLARE_NATIVE_FUNCTION(shift);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_locale_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(unshift);
|
||||
JS_DECLARE_NATIVE_FUNCTION(join);
|
||||
JS_DECLARE_NATIVE_FUNCTION(concat);
|
||||
JS_DECLARE_NATIVE_FUNCTION(slice);
|
||||
JS_DECLARE_NATIVE_FUNCTION(index_of);
|
||||
JS_DECLARE_NATIVE_FUNCTION(reduce);
|
||||
JS_DECLARE_NATIVE_FUNCTION(reduce_right);
|
||||
JS_DECLARE_NATIVE_FUNCTION(reverse);
|
||||
JS_DECLARE_NATIVE_FUNCTION(sort);
|
||||
JS_DECLARE_NATIVE_FUNCTION(last_index_of);
|
||||
JS_DECLARE_NATIVE_FUNCTION(includes);
|
||||
JS_DECLARE_NATIVE_FUNCTION(find);
|
||||
JS_DECLARE_NATIVE_FUNCTION(find_index);
|
||||
JS_DECLARE_NATIVE_FUNCTION(find_last);
|
||||
JS_DECLARE_NATIVE_FUNCTION(find_last_index);
|
||||
JS_DECLARE_NATIVE_FUNCTION(some);
|
||||
JS_DECLARE_NATIVE_FUNCTION(every);
|
||||
JS_DECLARE_NATIVE_FUNCTION(splice);
|
||||
JS_DECLARE_NATIVE_FUNCTION(fill);
|
||||
JS_DECLARE_NATIVE_FUNCTION(values);
|
||||
JS_DECLARE_NATIVE_FUNCTION(flat);
|
||||
JS_DECLARE_NATIVE_FUNCTION(flat_map);
|
||||
JS_DECLARE_NATIVE_FUNCTION(at);
|
||||
JS_DECLARE_NATIVE_FUNCTION(keys);
|
||||
JS_DECLARE_NATIVE_FUNCTION(entries);
|
||||
JS_DECLARE_NATIVE_FUNCTION(copy_within);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(filter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(for_each);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(map);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(pop);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(push);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(shift);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_locale_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(unshift);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(join);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(concat);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(slice);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(index_of);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(reduce);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(reduce_right);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(reverse);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(sort);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(last_index_of);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(includes);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(find);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(find_index);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(find_last);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(find_last_index);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(some);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(every);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(splice);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(fill);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(values);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(flat);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(flat_map);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(at);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(keys);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(entries);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(copy_within);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ void AtomicsObject::initialize(GlobalObject& global_object)
|
|||
}
|
||||
|
||||
// 25.4.3 Atomics.add ( typedArray, index, value ), https://tc39.es/ecma262/#sec-atomics.add
|
||||
JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::add)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(AtomicsObject::add)
|
||||
{
|
||||
auto* typed_array = typed_array_from(global_object, vm.argument(0));
|
||||
if (!typed_array)
|
||||
|
@ -180,7 +180,7 @@ JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::add)
|
|||
}
|
||||
|
||||
// 25.4.4 Atomics.and ( typedArray, index, value ), https://tc39.es/ecma262/#sec-atomics.and
|
||||
JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::and_)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(AtomicsObject::and_)
|
||||
{
|
||||
auto* typed_array = typed_array_from(global_object, vm.argument(0));
|
||||
if (!typed_array)
|
||||
|
@ -278,7 +278,7 @@ static ThrowCompletionOr<Value> atomic_compare_exchange_impl(GlobalObject& globa
|
|||
}
|
||||
|
||||
// 25.4.5 Atomics.compareExchange ( typedArray, index, expectedValue, replacementValue ), https://tc39.es/ecma262/#sec-atomics.compareexchange
|
||||
JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::compare_exchange)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(AtomicsObject::compare_exchange)
|
||||
{
|
||||
auto* typed_array = typed_array_from(global_object, vm.argument(0));
|
||||
if (!typed_array)
|
||||
|
@ -294,7 +294,7 @@ JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::compare_exchange)
|
|||
}
|
||||
|
||||
// 25.4.6 Atomics.exchange ( typedArray, index, value ), https://tc39.es/ecma262/#sec-atomics.exchange
|
||||
JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::exchange)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(AtomicsObject::exchange)
|
||||
{
|
||||
auto* typed_array = typed_array_from(global_object, vm.argument(0));
|
||||
if (!typed_array)
|
||||
|
@ -312,7 +312,7 @@ JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::exchange)
|
|||
}
|
||||
|
||||
// 25.4.7 Atomics.isLockFree ( size ), https://tc39.es/ecma262/#sec-atomics.islockfree
|
||||
JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::is_lock_free)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(AtomicsObject::is_lock_free)
|
||||
{
|
||||
auto size = TRY_OR_DISCARD(vm.argument(0).to_integer_or_infinity(global_object));
|
||||
if (size == 1)
|
||||
|
@ -327,7 +327,7 @@ JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::is_lock_free)
|
|||
}
|
||||
|
||||
// 25.4.8 Atomics.load ( typedArray, index ), https://tc39.es/ecma262/#sec-atomics.load
|
||||
JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::load)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(AtomicsObject::load)
|
||||
{
|
||||
auto* typed_array = typed_array_from(global_object, vm.argument(0));
|
||||
if (!typed_array)
|
||||
|
@ -346,7 +346,7 @@ JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::load)
|
|||
}
|
||||
|
||||
// 25.4.9 Atomics.or ( typedArray, index, value ), https://tc39.es/ecma262/#sec-atomics.or
|
||||
JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::or_)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(AtomicsObject::or_)
|
||||
{
|
||||
auto* typed_array = typed_array_from(global_object, vm.argument(0));
|
||||
if (!typed_array)
|
||||
|
@ -364,7 +364,7 @@ JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::or_)
|
|||
}
|
||||
|
||||
// 25.4.10 Atomics.store ( typedArray, index, value ), https://tc39.es/ecma262/#sec-atomics.store
|
||||
JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::store)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(AtomicsObject::store)
|
||||
{
|
||||
auto* typed_array = typed_array_from(global_object, vm.argument(0));
|
||||
if (!typed_array)
|
||||
|
@ -391,7 +391,7 @@ JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::store)
|
|||
}
|
||||
|
||||
// 25.4.11 Atomics.sub ( typedArray, index, value ), https://tc39.es/ecma262/#sec-atomics.sub
|
||||
JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::sub)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(AtomicsObject::sub)
|
||||
{
|
||||
auto* typed_array = typed_array_from(global_object, vm.argument(0));
|
||||
if (!typed_array)
|
||||
|
@ -409,7 +409,7 @@ JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::sub)
|
|||
}
|
||||
|
||||
// 25.4.14 Atomics.xor ( typedArray, index, value ), https://tc39.es/ecma262/#sec-atomics.xor
|
||||
JS_DEFINE_NATIVE_FUNCTION(AtomicsObject::xor_)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(AtomicsObject::xor_)
|
||||
{
|
||||
auto* typed_array = typed_array_from(global_object, vm.argument(0));
|
||||
if (!typed_array)
|
||||
|
|
|
@ -19,16 +19,16 @@ public:
|
|||
virtual ~AtomicsObject() override = default;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(add);
|
||||
JS_DECLARE_NATIVE_FUNCTION(and_);
|
||||
JS_DECLARE_NATIVE_FUNCTION(compare_exchange);
|
||||
JS_DECLARE_NATIVE_FUNCTION(exchange);
|
||||
JS_DECLARE_NATIVE_FUNCTION(is_lock_free);
|
||||
JS_DECLARE_NATIVE_FUNCTION(load);
|
||||
JS_DECLARE_NATIVE_FUNCTION(or_);
|
||||
JS_DECLARE_NATIVE_FUNCTION(store);
|
||||
JS_DECLARE_NATIVE_FUNCTION(sub);
|
||||
JS_DECLARE_NATIVE_FUNCTION(xor_);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(add);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(and_);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(compare_exchange);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(exchange);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(is_lock_free);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(load);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(or_);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(store);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(sub);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(xor_);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -66,13 +66,13 @@ Value BigIntConstructor::construct(FunctionObject&)
|
|||
}
|
||||
|
||||
// 21.2.2.1 BigInt.asIntN ( bits, bigint ), https://tc39.es/ecma262/#sec-bigint.asintn
|
||||
JS_DEFINE_NATIVE_FUNCTION(BigIntConstructor::as_int_n)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(BigIntConstructor::as_int_n)
|
||||
{
|
||||
TODO();
|
||||
}
|
||||
|
||||
// 21.2.2.2 BigInt.asUintN ( bits, bigint ), https://tc39.es/ecma262/#sec-bigint.asuintn
|
||||
JS_DEFINE_NATIVE_FUNCTION(BigIntConstructor::as_uint_n)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(BigIntConstructor::as_uint_n)
|
||||
{
|
||||
TODO();
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ public:
|
|||
private:
|
||||
virtual bool has_constructor() const override { return true; }
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(as_int_n);
|
||||
JS_DECLARE_NATIVE_FUNCTION(as_uint_n);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(as_int_n);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(as_uint_n);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ static ThrowCompletionOr<BigInt*> this_bigint_value(GlobalObject& global_object,
|
|||
}
|
||||
|
||||
// 21.2.3.3 BigInt.prototype.toString ( [ radix ] ), https://tc39.es/ecma262/#sec-bigint.prototype.tostring
|
||||
JS_DEFINE_NATIVE_FUNCTION(BigIntPrototype::to_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(BigIntPrototype::to_string)
|
||||
{
|
||||
auto* bigint = TRY_OR_DISCARD(this_bigint_value(global_object, vm.this_value(global_object)));
|
||||
double radix = 10;
|
||||
|
@ -63,13 +63,13 @@ JS_DEFINE_NATIVE_FUNCTION(BigIntPrototype::to_string)
|
|||
}
|
||||
|
||||
// 21.2.3.2 BigInt.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ), https://tc39.es/ecma262/#sec-bigint.prototype.tolocalestring
|
||||
JS_DEFINE_NATIVE_FUNCTION(BigIntPrototype::to_locale_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(BigIntPrototype::to_locale_string)
|
||||
{
|
||||
return to_string(vm, global_object);
|
||||
}
|
||||
|
||||
// 21.2.3.4 BigInt.prototype.valueOf ( ), https://tc39.es/ecma262/#sec-bigint.prototype.valueof
|
||||
JS_DEFINE_NATIVE_FUNCTION(BigIntPrototype::value_of)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(BigIntPrototype::value_of)
|
||||
{
|
||||
return TRY_OR_DISCARD(this_bigint_value(global_object, vm.this_value(global_object)));
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ public:
|
|||
virtual ~BigIntPrototype() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_locale_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(value_of);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_locale_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(value_of);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ BooleanPrototype::~BooleanPrototype()
|
|||
}
|
||||
|
||||
// 20.3.3.2 Boolean.prototype.toString ( ), https://tc39.es/ecma262/#sec-boolean.prototype.tostring
|
||||
JS_DEFINE_NATIVE_FUNCTION(BooleanPrototype::to_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(BooleanPrototype::to_string)
|
||||
{
|
||||
auto this_value = vm.this_value(global_object);
|
||||
if (this_value.is_boolean())
|
||||
|
@ -46,7 +46,7 @@ JS_DEFINE_NATIVE_FUNCTION(BooleanPrototype::to_string)
|
|||
}
|
||||
|
||||
// 20.3.3.3 Boolean.prototype.valueOf ( ), https://tc39.es/ecma262/#sec-boolean.prototype.valueof
|
||||
JS_DEFINE_NATIVE_FUNCTION(BooleanPrototype::value_of)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(BooleanPrototype::value_of)
|
||||
{
|
||||
auto this_value = vm.this_value(global_object);
|
||||
if (this_value.is_boolean())
|
||||
|
|
|
@ -19,8 +19,8 @@ public:
|
|||
virtual ~BooleanPrototype() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(value_of);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(value_of);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -39,61 +39,61 @@ ConsoleObject::~ConsoleObject()
|
|||
}
|
||||
|
||||
// 1.1.6. log(...data), https://console.spec.whatwg.org/#log
|
||||
JS_DEFINE_NATIVE_FUNCTION(ConsoleObject::log)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ConsoleObject::log)
|
||||
{
|
||||
return global_object.console().log();
|
||||
}
|
||||
|
||||
// 1.1.3. debug(...data), https://console.spec.whatwg.org/#debug
|
||||
JS_DEFINE_NATIVE_FUNCTION(ConsoleObject::debug)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ConsoleObject::debug)
|
||||
{
|
||||
return global_object.console().debug();
|
||||
}
|
||||
|
||||
// 1.1.5. info(...data), https://console.spec.whatwg.org/#info
|
||||
JS_DEFINE_NATIVE_FUNCTION(ConsoleObject::info)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ConsoleObject::info)
|
||||
{
|
||||
return global_object.console().info();
|
||||
}
|
||||
|
||||
// 1.1.9. warn(...data), https://console.spec.whatwg.org/#warn
|
||||
JS_DEFINE_NATIVE_FUNCTION(ConsoleObject::warn)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ConsoleObject::warn)
|
||||
{
|
||||
return global_object.console().warn();
|
||||
}
|
||||
|
||||
// 1.1.4. error(...data), https://console.spec.whatwg.org/#error
|
||||
JS_DEFINE_NATIVE_FUNCTION(ConsoleObject::error)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ConsoleObject::error)
|
||||
{
|
||||
return global_object.console().error();
|
||||
}
|
||||
|
||||
// 1.1.8. trace(...data), https://console.spec.whatwg.org/#trace
|
||||
JS_DEFINE_NATIVE_FUNCTION(ConsoleObject::trace)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ConsoleObject::trace)
|
||||
{
|
||||
return global_object.console().trace();
|
||||
}
|
||||
|
||||
// 1.2.1. count(label), https://console.spec.whatwg.org/#count
|
||||
JS_DEFINE_NATIVE_FUNCTION(ConsoleObject::count)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ConsoleObject::count)
|
||||
{
|
||||
return global_object.console().count();
|
||||
}
|
||||
|
||||
// 1.2.2. countReset(label), https://console.spec.whatwg.org/#countreset
|
||||
JS_DEFINE_NATIVE_FUNCTION(ConsoleObject::count_reset)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ConsoleObject::count_reset)
|
||||
{
|
||||
return global_object.console().count_reset();
|
||||
}
|
||||
|
||||
// 1.1.2. clear(), https://console.spec.whatwg.org/#clear
|
||||
JS_DEFINE_NATIVE_FUNCTION(ConsoleObject::clear)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ConsoleObject::clear)
|
||||
{
|
||||
return global_object.console().clear();
|
||||
}
|
||||
|
||||
// 1.1.1. assert(condition, ...data), https://console.spec.whatwg.org/#assert
|
||||
JS_DEFINE_NATIVE_FUNCTION(ConsoleObject::assert_)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ConsoleObject::assert_)
|
||||
{
|
||||
return global_object.console().assert_();
|
||||
}
|
||||
|
|
|
@ -19,16 +19,16 @@ public:
|
|||
virtual ~ConsoleObject() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(log);
|
||||
JS_DECLARE_NATIVE_FUNCTION(debug);
|
||||
JS_DECLARE_NATIVE_FUNCTION(info);
|
||||
JS_DECLARE_NATIVE_FUNCTION(warn);
|
||||
JS_DECLARE_NATIVE_FUNCTION(error);
|
||||
JS_DECLARE_NATIVE_FUNCTION(trace);
|
||||
JS_DECLARE_NATIVE_FUNCTION(count);
|
||||
JS_DECLARE_NATIVE_FUNCTION(count_reset);
|
||||
JS_DECLARE_NATIVE_FUNCTION(clear);
|
||||
JS_DECLARE_NATIVE_FUNCTION(assert_);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(log);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(debug);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(info);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(warn);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(error);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(trace);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(count);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(count_reset);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(clear);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(assert_);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -130,125 +130,125 @@ static Value set_view_value(GlobalObject& global_object, Value request_index, Va
|
|||
}
|
||||
|
||||
// 25.3.4.5 DataView.prototype.getBigInt64 ( byteOffset [ , littleEndian ] ), https://tc39.es/ecma262/#sec-dataview.prototype.getbigint64
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::get_big_int_64)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::get_big_int_64)
|
||||
{
|
||||
return get_view_value<i64>(global_object, vm.argument(0), vm.argument(1));
|
||||
}
|
||||
|
||||
// 25.3.4.6 DataView.prototype.getBigUint64 ( byteOffset [ , littleEndian ] ), https://tc39.es/ecma262/#sec-dataview.prototype.getbiguint64
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::get_big_uint_64)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::get_big_uint_64)
|
||||
{
|
||||
return get_view_value<u64>(global_object, vm.argument(0), vm.argument(1));
|
||||
}
|
||||
|
||||
// 25.3.4.7 DataView.prototype.getFloat32 ( byteOffset [ , littleEndian ] ), https://tc39.es/ecma262/#sec-dataview.prototype.getfloat32
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::get_float_32)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::get_float_32)
|
||||
{
|
||||
return get_view_value<float>(global_object, vm.argument(0), vm.argument(1));
|
||||
}
|
||||
|
||||
// 25.3.4.8 DataView.prototype.getFloat64 ( byteOffset [ , littleEndian ] ), https://tc39.es/ecma262/#sec-dataview.prototype.getfloat64
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::get_float_64)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::get_float_64)
|
||||
{
|
||||
return get_view_value<double>(global_object, vm.argument(0), vm.argument(1));
|
||||
}
|
||||
|
||||
// 25.3.4.9 DataView.prototype.getInt8 ( byteOffset ), https://tc39.es/ecma262/#sec-dataview.prototype.getint8
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::get_int_8)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::get_int_8)
|
||||
{
|
||||
return get_view_value<i8>(global_object, vm.argument(0), Value(true));
|
||||
}
|
||||
|
||||
// 25.3.4.10 DataView.prototype.getInt16 ( byteOffset [ , littleEndian ] ), https://tc39.es/ecma262/#sec-dataview.prototype.getint16
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::get_int_16)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::get_int_16)
|
||||
{
|
||||
return get_view_value<i16>(global_object, vm.argument(0), vm.argument(1));
|
||||
}
|
||||
|
||||
// 25.3.4.11 DataView.prototype.getInt32 ( byteOffset [ , littleEndian ] ), https://tc39.es/ecma262/#sec-dataview.prototype.getint32
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::get_int_32)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::get_int_32)
|
||||
{
|
||||
return get_view_value<i32>(global_object, vm.argument(0), vm.argument(1));
|
||||
}
|
||||
|
||||
// 25.3.4.12 DataView.prototype.getUint8 ( byteOffset ), https://tc39.es/ecma262/#sec-dataview.prototype.getuint8
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::get_uint_8)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::get_uint_8)
|
||||
{
|
||||
return get_view_value<u8>(global_object, vm.argument(0), Value(true));
|
||||
}
|
||||
|
||||
// 25.3.4.13 DataView.prototype.getUint16 ( byteOffset [ , littleEndian ] ), https://tc39.es/ecma262/#sec-dataview.prototype.getuint16
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::get_uint_16)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::get_uint_16)
|
||||
{
|
||||
return get_view_value<u16>(global_object, vm.argument(0), vm.argument(1));
|
||||
}
|
||||
|
||||
// 25.3.4.14 DataView.prototype.getUint32 ( byteOffset [ , littleEndian ] ), https://tc39.es/ecma262/#sec-dataview.prototype.getuint32
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::get_uint_32)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::get_uint_32)
|
||||
{
|
||||
return get_view_value<u32>(global_object, vm.argument(0), vm.argument(1));
|
||||
}
|
||||
|
||||
// 25.3.4.15 DataView.prototype.setBigInt64 ( byteOffset, value [ , littleEndian ] ), https://tc39.es/ecma262/#sec-dataview.prototype.setbigint64
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::set_big_int_64)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::set_big_int_64)
|
||||
{
|
||||
return set_view_value<i64>(global_object, vm.argument(0), vm.argument(2), vm.argument(1));
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::set_big_uint_64)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::set_big_uint_64)
|
||||
{
|
||||
return set_view_value<u64>(global_object, vm.argument(0), vm.argument(2), vm.argument(1));
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::set_float_32)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::set_float_32)
|
||||
{
|
||||
return set_view_value<float>(global_object, vm.argument(0), vm.argument(2), vm.argument(1));
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::set_float_64)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::set_float_64)
|
||||
{
|
||||
return set_view_value<double>(global_object, vm.argument(0), vm.argument(2), vm.argument(1));
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::set_int_8)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::set_int_8)
|
||||
{
|
||||
return set_view_value<i8>(global_object, vm.argument(0), Value(true), vm.argument(1));
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::set_int_16)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::set_int_16)
|
||||
{
|
||||
return set_view_value<i16>(global_object, vm.argument(0), vm.argument(2), vm.argument(1));
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::set_int_32)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::set_int_32)
|
||||
{
|
||||
return set_view_value<i32>(global_object, vm.argument(0), vm.argument(2), vm.argument(1));
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::set_uint_8)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::set_uint_8)
|
||||
{
|
||||
return set_view_value<u8>(global_object, vm.argument(0), Value(true), vm.argument(1));
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::set_uint_16)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::set_uint_16)
|
||||
{
|
||||
return set_view_value<u16>(global_object, vm.argument(0), vm.argument(2), vm.argument(1));
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::set_uint_32)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::set_uint_32)
|
||||
{
|
||||
return set_view_value<u32>(global_object, vm.argument(0), vm.argument(2), vm.argument(1));
|
||||
}
|
||||
|
||||
// 25.3.4.1 get DataView.prototype.buffer, https://tc39.es/ecma262/#sec-get-dataview.prototype.buffer
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::buffer_getter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::buffer_getter)
|
||||
{
|
||||
auto* data_view = TRY_OR_DISCARD(typed_this_value(global_object));
|
||||
return data_view->viewed_array_buffer();
|
||||
}
|
||||
|
||||
// 25.3.4.2 get DataView.prototype.byteLength, https://tc39.es/ecma262/#sec-get-dataview.prototype.bytelength
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::byte_length_getter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::byte_length_getter)
|
||||
{
|
||||
auto* data_view = TRY_OR_DISCARD(typed_this_value(global_object));
|
||||
if (data_view->viewed_array_buffer()->is_detached()) {
|
||||
|
@ -259,7 +259,7 @@ JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::byte_length_getter)
|
|||
}
|
||||
|
||||
// 25.3.4.3 get DataView.prototype.byteOffset, https://tc39.es/ecma262/#sec-get-dataview.prototype.byteoffset
|
||||
JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::byte_offset_getter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DataViewPrototype::byte_offset_getter)
|
||||
{
|
||||
auto* data_view = TRY_OR_DISCARD(typed_this_value(global_object));
|
||||
if (data_view->viewed_array_buffer()->is_detached()) {
|
||||
|
|
|
@ -20,30 +20,30 @@ public:
|
|||
virtual ~DataViewPrototype() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_big_int_64);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_big_uint_64);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_float_32);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_float_64);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_int_8);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_int_16);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_int_32);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_uint_8);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_uint_16);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_uint_32);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_big_int_64);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_big_uint_64);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_float_32);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_float_64);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_int_8);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_int_16);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_int_32);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_uint_8);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_uint_16);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_uint_32);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_big_int_64);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_big_uint_64);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_float_32);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_float_64);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_int_8);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_int_16);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_int_32);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_uint_8);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_uint_16);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_uint_32);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_big_int_64);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_big_uint_64);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_float_32);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_float_64);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_int_8);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_int_16);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_int_32);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_uint_8);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_uint_16);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_uint_32);
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(buffer_getter);
|
||||
JS_DECLARE_NATIVE_FUNCTION(byte_length_getter);
|
||||
JS_DECLARE_NATIVE_FUNCTION(byte_offset_getter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(buffer_getter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(byte_length_getter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(byte_offset_getter);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -289,7 +289,7 @@ Value DateConstructor::construct(FunctionObject& new_target)
|
|||
}
|
||||
|
||||
// 21.4.3.1 Date.now ( ), https://tc39.es/ecma262/#sec-date.now
|
||||
JS_DEFINE_NATIVE_FUNCTION(DateConstructor::now)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DateConstructor::now)
|
||||
{
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, nullptr);
|
||||
|
@ -297,7 +297,7 @@ JS_DEFINE_NATIVE_FUNCTION(DateConstructor::now)
|
|||
}
|
||||
|
||||
// 21.4.3.2 Date.parse ( string ), https://tc39.es/ecma262/#sec-date.parse
|
||||
JS_DEFINE_NATIVE_FUNCTION(DateConstructor::parse)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DateConstructor::parse)
|
||||
{
|
||||
if (!vm.argument_count())
|
||||
return js_nan();
|
||||
|
@ -308,7 +308,7 @@ JS_DEFINE_NATIVE_FUNCTION(DateConstructor::parse)
|
|||
}
|
||||
|
||||
// 21.4.3.4 Date.UTC ( year [ , month [ , date [ , hours [ , minutes [ , seconds [ , ms ] ] ] ] ] ] ), https://tc39.es/ecma262/#sec-date.utc
|
||||
JS_DEFINE_NATIVE_FUNCTION(DateConstructor::utc)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DateConstructor::utc)
|
||||
{
|
||||
auto arg_or = [&vm, &global_object](size_t i, i32 fallback) -> ThrowCompletionOr<i32> {
|
||||
return vm.argument_count() > i ? vm.argument(i).to_i32(global_object) : fallback;
|
||||
|
|
|
@ -24,9 +24,9 @@ public:
|
|||
private:
|
||||
virtual bool has_constructor() const override { return true; }
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(now);
|
||||
JS_DECLARE_NATIVE_FUNCTION(parse);
|
||||
JS_DECLARE_NATIVE_FUNCTION(utc);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(now);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(parse);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(utc);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ DatePrototype::~DatePrototype()
|
|||
}
|
||||
|
||||
// 21.4.4.2 Date.prototype.getDate ( ), https://tc39.es/ecma262/#sec-date.prototype.getdate
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_date)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_date)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -104,7 +104,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_date)
|
|||
}
|
||||
|
||||
// 21.4.4.20 Date.prototype.setDate ( date ), https://tc39.es/ecma262/#sec-date.prototype.setdate
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_date)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::set_date)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -128,7 +128,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_date)
|
|||
}
|
||||
|
||||
// 21.4.4.3 Date.prototype.getDay ( ), https://tc39.es/ecma262/#sec-date.prototype.getday
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_day)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_day)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -139,7 +139,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_day)
|
|||
}
|
||||
|
||||
// 21.4.4.4 Date.prototype.getFullYear ( ), https://tc39.es/ecma262/#sec-date.prototype.getfullyear
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_full_year)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_full_year)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -150,7 +150,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_full_year)
|
|||
}
|
||||
|
||||
// 21.4.4.21 Date.prototype.setFullYear ( year [ , month [ , date ] ] ), https://tc39.es/ecma262/#sec-date.prototype.setfullyear
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_full_year)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::set_full_year)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -193,7 +193,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_full_year)
|
|||
}
|
||||
|
||||
// B.2.4.1 Date.prototype.getYear ( ), https://tc39.es/ecma262/#sec-date.prototype.getyear
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_year)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_year)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -204,7 +204,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_year)
|
|||
}
|
||||
|
||||
// B.2.4.2 Date.prototype.setYear ( year ), https://tc39.es/ecma262/#sec-date.prototype.setyear
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_year)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::set_year)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -231,7 +231,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_year)
|
|||
}
|
||||
|
||||
// 21.4.4.5 Date.prototype.getHours ( ), https://tc39.es/ecma262/#sec-date.prototype.gethours
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_hours)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_hours)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -242,7 +242,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_hours)
|
|||
}
|
||||
|
||||
// 21.4.4.22 Date.prototype.setHours ( hour [ , min [ , sec [ , ms ] ] ] ), https://tc39.es/ecma262/#sec-date.prototype.sethours
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_hours)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::set_hours)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -294,7 +294,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_hours)
|
|||
}
|
||||
|
||||
// 21.4.4.23 Date.prototype.setMilliseconds ( ms ), https://tc39.es/ecma262/#sec-date.prototype.setmilliseconds
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_milliseconds)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_milliseconds)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -305,7 +305,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_milliseconds)
|
|||
}
|
||||
|
||||
// 21.4.4.23 Date.prototype.setMilliseconds ( ms ), https://tc39.es/ecma262/#sec-date.prototype.setmilliseconds
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_milliseconds)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::set_milliseconds)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -337,7 +337,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_milliseconds)
|
|||
}
|
||||
|
||||
// 21.4.4.7 Date.prototype.getMinutes ( ), https://tc39.es/ecma262/#sec-date.prototype.getminutes
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_minutes)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_minutes)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -348,7 +348,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_minutes)
|
|||
}
|
||||
|
||||
// 21.4.4.24 Date.prototype.setMinutes ( min [ , sec [ , ms ] ] ), https://tc39.es/ecma262/#sec-date.prototype.setminutes
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_minutes)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::set_minutes)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -393,7 +393,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_minutes)
|
|||
}
|
||||
|
||||
// 21.4.4.8 Date.prototype.getMonth ( ), https://tc39.es/ecma262/#sec-date.prototype.getmonth
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_month)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_month)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -404,7 +404,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_month)
|
|||
}
|
||||
|
||||
// 21.4.4.25 Date.prototype.setMonth ( month [ , date ] ), https://tc39.es/ecma262/#sec-date.prototype.setmonth
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_month)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::set_month)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -439,7 +439,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_month)
|
|||
}
|
||||
|
||||
// 21.4.4.9 Date.prototype.getSeconds ( ), https://tc39.es/ecma262/#sec-date.prototype.getseconds
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_seconds)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_seconds)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -450,7 +450,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_seconds)
|
|||
}
|
||||
|
||||
// 21.4.4.26 Date.prototype.setSeconds ( sec [ , ms ] ), https://tc39.es/ecma262/#sec-date.prototype.setseconds
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_seconds)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::set_seconds)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -488,7 +488,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_seconds)
|
|||
}
|
||||
|
||||
// 21.4.4.10 Date.prototype.getTime ( ), https://tc39.es/ecma262/#sec-date.prototype.gettime
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_time)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_time)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -499,7 +499,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_time)
|
|||
}
|
||||
|
||||
// 21.4.4.27 Date.prototype.setTime ( time ), https://tc39.es/ecma262/#sec-date.prototype.settime
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_time)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::set_time)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -524,7 +524,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_time)
|
|||
}
|
||||
|
||||
// 21.4.4.11 Date.prototype.getTimezoneOffset ( ), https://tc39.es/ecma262/#sec-date.prototype.gettimezoneoffset
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_timezone_offset)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_timezone_offset)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -536,7 +536,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_timezone_offset)
|
|||
}
|
||||
|
||||
// 21.4.4.12 Date.prototype.getUTCDate ( ), https://tc39.es/ecma262/#sec-date.prototype.getutcdate
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_date)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_utc_date)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -547,7 +547,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_date)
|
|||
}
|
||||
|
||||
// 21.4.4.13 Date.prototype.getUTCDay ( ), https://tc39.es/ecma262/#sec-date.prototype.getutcday
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_day)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_utc_day)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -558,7 +558,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_day)
|
|||
}
|
||||
|
||||
// 21.4.4.14 Date.prototype.getUTCFullYear ( ), https://tc39.es/ecma262/#sec-date.prototype.getutcfullyear
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_full_year)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_utc_full_year)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -569,7 +569,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_full_year)
|
|||
}
|
||||
|
||||
// 21.4.4.15 Date.prototype.getUTCHours ( ), https://tc39.es/ecma262/#sec-date.prototype.getutchours
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_hours)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_utc_hours)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -580,7 +580,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_hours)
|
|||
}
|
||||
|
||||
// 21.4.4.16 Date.prototype.getUTCMilliseconds ( ), https://tc39.es/ecma262/#sec-date.prototype.getutcmilliseconds
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_milliseconds)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_utc_milliseconds)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -591,7 +591,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_milliseconds)
|
|||
}
|
||||
|
||||
// 21.4.4.18 Date.prototype.getUTCMonth ( ), https://tc39.es/ecma262/#sec-date.prototype.getutcmonth
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_month)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_utc_month)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -602,7 +602,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_month)
|
|||
}
|
||||
|
||||
// 21.4.4.17 Date.prototype.getUTCMinutes ( ), https://tc39.es/ecma262/#sec-date.prototype.getutcminutes
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_minutes)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_utc_minutes)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -613,7 +613,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_minutes)
|
|||
}
|
||||
|
||||
// 21.4.4.19 Date.prototype.getUTCSeconds ( ), https://tc39.es/ecma262/#sec-date.prototype.getutcseconds
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_seconds)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::get_utc_seconds)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -624,7 +624,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_seconds)
|
|||
}
|
||||
|
||||
// 21.4.4.35 Date.prototype.toDateString ( ), https://tc39.es/ecma262/#sec-date.prototype.todatestring
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_date_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::to_date_string)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -636,14 +636,14 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_date_string)
|
|||
}
|
||||
|
||||
// B.2.4.3 Date.prototype.toGMTString ( ), https://tc39.es/ecma262/#sec-date.prototype.togmtstring
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_gmt_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::to_gmt_string)
|
||||
{
|
||||
// NOTE: The toUTCString method is preferred. The toGMTString method is provided principally for compatibility with old code.
|
||||
return to_utc_string(vm, global_object);
|
||||
}
|
||||
|
||||
// 21.4.4.43 Date.prototype.toUTCString ( ), https://tc39.es/ecma262/#sec-date.prototype.toutcstring
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_utc_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::to_utc_string)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -656,7 +656,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_utc_string)
|
|||
}
|
||||
|
||||
// 21.4.4.36 Date.prototype.toISOString ( ), https://tc39.es/ecma262/#sec-date.prototype.toisostring
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_iso_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::to_iso_string)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -670,7 +670,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_iso_string)
|
|||
}
|
||||
|
||||
// 21.4.4.38 Date.prototype.toLocaleDateString ( [ reserved1 [ , reserved2 ] ] ), https://tc39.es/ecma262/#sec-date.prototype.tolocaledatestring
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_locale_date_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::to_locale_date_string)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -683,7 +683,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_locale_date_string)
|
|||
}
|
||||
|
||||
// 21.4.4.39 Date.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ), https://tc39.es/ecma262/#sec-date.prototype.tolocalestring
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_locale_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::to_locale_string)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -696,7 +696,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_locale_string)
|
|||
}
|
||||
|
||||
// 21.4.4.40 Date.prototype.toLocaleTimeString ( [ reserved1 [ , reserved2 ] ] ), https://tc39.es/ecma262/#sec-date.prototype.tolocaletimestring
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_locale_time_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::to_locale_time_string)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -709,7 +709,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_locale_time_string)
|
|||
}
|
||||
|
||||
// 21.4.4.42 Date.prototype.toTimeString ( ), https://tc39.es/ecma262/#sec-date.prototype.totimestring
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_time_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::to_time_string)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -721,7 +721,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_time_string)
|
|||
}
|
||||
|
||||
// 21.4.4.41 Date.prototype.toString ( ), https://tc39.es/ecma262/#sec-date.prototype.tostring
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::to_string)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -733,7 +733,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_string)
|
|||
}
|
||||
|
||||
// 21.4.4.37 Date.prototype.toJSON ( key ), https://tc39.es/ecma262/#sec-date.prototype.tojson
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_json)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::to_json)
|
||||
{
|
||||
auto this_value = vm.this_value(global_object);
|
||||
|
||||
|
@ -746,7 +746,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_json)
|
|||
}
|
||||
|
||||
// 14.1.1 Date.prototype.toTemporalInstant ( ), https://tc39.es/proposal-temporal/#sec-date.prototype.totemporalinstant
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_temporal_instant)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::to_temporal_instant)
|
||||
{
|
||||
// 1. Let t be ? thisTimeValue(this value).
|
||||
auto* this_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
@ -763,7 +763,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_temporal_instant)
|
|||
}
|
||||
|
||||
// 21.4.4.45 Date.prototype [ @@toPrimitive ] ( hint ), https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive
|
||||
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::symbol_to_primitive)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DatePrototype::symbol_to_primitive)
|
||||
{
|
||||
auto this_value = vm.this_value(global_object);
|
||||
if (!this_value.is_object()) {
|
||||
|
|
|
@ -20,46 +20,46 @@ public:
|
|||
virtual ~DatePrototype() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_date);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_date);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_day);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_full_year);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_full_year);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_year);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_year);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_hours);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_hours);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_milliseconds);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_milliseconds);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_minutes);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_minutes);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_month);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_month);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_seconds);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_seconds);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_time);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_time);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_timezone_offset);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_utc_date);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_utc_day);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_utc_full_year);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_utc_hours);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_utc_milliseconds);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_utc_minutes);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_utc_month);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_utc_seconds);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_date_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_gmt_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_utc_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_iso_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_locale_date_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_locale_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_locale_time_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_time_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_json);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_temporal_instant);
|
||||
JS_DECLARE_NATIVE_FUNCTION(symbol_to_primitive);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_date);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_date);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_day);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_full_year);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_full_year);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_year);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_year);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_hours);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_hours);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_milliseconds);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_milliseconds);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_minutes);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_minutes);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_month);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_month);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_seconds);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_seconds);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_time);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_time);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_timezone_offset);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_utc_date);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_utc_day);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_utc_full_year);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_utc_hours);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_utc_milliseconds);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_utc_minutes);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_utc_month);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_utc_seconds);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_date_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_gmt_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_utc_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_iso_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_locale_date_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_locale_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_locale_time_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_time_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_json);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_temporal_instant);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(symbol_to_primitive);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ void ErrorPrototype::initialize(GlobalObject& global_object)
|
|||
}
|
||||
|
||||
// 20.5.3.4 Error.prototype.toString ( ), https://tc39.es/ecma262/#sec-error.prototype.tostring
|
||||
JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::to_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ErrorPrototype::to_string)
|
||||
{
|
||||
auto this_value = vm.this_value(global_object);
|
||||
if (!this_value.is_object()) {
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
virtual ~ErrorPrototype() override = default;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_string);
|
||||
};
|
||||
|
||||
#define DECLARE_NATIVE_ERROR_PROTOTYPE(ClassName, snake_name, PrototypeName, ConstructorName) \
|
||||
|
|
|
@ -33,7 +33,7 @@ FinalizationRegistryPrototype::~FinalizationRegistryPrototype()
|
|||
}
|
||||
|
||||
// @STAGE 2@ FinalizationRegistry.prototype.cleanupSome ( [ callback ] ), https://github.com/tc39/proposal-cleanup-some/blob/master/spec/finalization-registry.html
|
||||
JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::cleanup_some)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(FinalizationRegistryPrototype::cleanup_some)
|
||||
{
|
||||
auto* finalization_registry = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -49,7 +49,7 @@ JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::cleanup_some)
|
|||
}
|
||||
|
||||
// 26.2.3.2 FinalizationRegistry.prototype.register ( target, heldValue [ , unregisterToken ] ), https://tc39.es/ecma262/#sec-finalization-registry.prototype.register
|
||||
JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::register_)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(FinalizationRegistryPrototype::register_)
|
||||
{
|
||||
auto* finalization_registry = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -77,7 +77,7 @@ JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::register_)
|
|||
}
|
||||
|
||||
// 26.2.3.3 FinalizationRegistry.prototype.unregister ( unregisterToken ), https://tc39.es/ecma262/#sec-finalization-registry.prototype.unregister
|
||||
JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::unregister)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(FinalizationRegistryPrototype::unregister)
|
||||
{
|
||||
auto* finalization_registry = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ public:
|
|||
virtual ~FinalizationRegistryPrototype() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(cleanup_some);
|
||||
JS_DECLARE_NATIVE_FUNCTION(register_);
|
||||
JS_DECLARE_NATIVE_FUNCTION(unregister);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(cleanup_some);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(register_);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(unregister);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ FunctionPrototype::~FunctionPrototype()
|
|||
}
|
||||
|
||||
// 20.2.3.1 Function.prototype.apply ( thisArg, argArray ), https://tc39.es/ecma262/#sec-function.prototype.apply
|
||||
JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::apply)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(FunctionPrototype::apply)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
if (!this_object->is_function()) {
|
||||
|
@ -60,7 +60,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::apply)
|
|||
}
|
||||
|
||||
// 20.2.3.2 Function.prototype.bind ( thisArg, ...args ), https://tc39.es/ecma262/#sec-function.prototype.bind
|
||||
JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::bind)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(FunctionPrototype::bind)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
if (!this_object->is_function()) {
|
||||
|
@ -80,7 +80,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::bind)
|
|||
}
|
||||
|
||||
// 20.2.3.3 Function.prototype.call ( thisArg, ...args ), https://tc39.es/ecma262/#sec-function.prototype.call
|
||||
JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::call)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(FunctionPrototype::call)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
if (!this_object->is_function()) {
|
||||
|
@ -98,7 +98,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::call)
|
|||
}
|
||||
|
||||
// 20.2.3.5 Function.prototype.toString ( ), https://tc39.es/ecma262/#sec-function.prototype.tostring
|
||||
JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::to_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(FunctionPrototype::to_string)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
if (!this_object->is_function()) {
|
||||
|
@ -149,7 +149,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::to_string)
|
|||
}
|
||||
|
||||
// 20.2.3.6 Function.prototype [ @@hasInstance ] ( V ), https://tc39.es/ecma262/#sec-function.prototype-@@hasinstance
|
||||
JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::symbol_has_instance)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(FunctionPrototype::symbol_has_instance)
|
||||
{
|
||||
return TRY_OR_DISCARD(ordinary_has_instance(global_object, vm.argument(0), vm.this_value(global_object)));
|
||||
}
|
||||
|
|
|
@ -19,11 +19,11 @@ public:
|
|||
virtual ~FunctionPrototype() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(apply);
|
||||
JS_DECLARE_NATIVE_FUNCTION(bind);
|
||||
JS_DECLARE_NATIVE_FUNCTION(call);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(symbol_has_instance);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(apply);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(bind);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(call);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(symbol_has_instance);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -33,14 +33,14 @@ GeneratorObjectPrototype::~GeneratorObjectPrototype()
|
|||
}
|
||||
|
||||
// 27.5.1.2 Generator.prototype.next ( value ), https://tc39.es/ecma262/#sec-generator.prototype.next
|
||||
JS_DEFINE_NATIVE_FUNCTION(GeneratorObjectPrototype::next)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(GeneratorObjectPrototype::next)
|
||||
{
|
||||
auto* generator_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
return generator_object->next_impl(vm, global_object, {});
|
||||
}
|
||||
|
||||
// 27.5.1.3 Generator.prototype.next ( value ), https://tc39.es/ecma262/#sec-generator.prototype.return
|
||||
JS_DEFINE_NATIVE_FUNCTION(GeneratorObjectPrototype::return_)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(GeneratorObjectPrototype::return_)
|
||||
{
|
||||
auto* generator_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
generator_object->set_done();
|
||||
|
@ -48,7 +48,7 @@ JS_DEFINE_NATIVE_FUNCTION(GeneratorObjectPrototype::return_)
|
|||
}
|
||||
|
||||
// 27.5.1.4 Generator.prototype.next ( value ), https://tc39.es/ecma262/#sec-generator.prototype.throw
|
||||
JS_DEFINE_NATIVE_FUNCTION(GeneratorObjectPrototype::throw_)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(GeneratorObjectPrototype::throw_)
|
||||
{
|
||||
auto* generator_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
return generator_object->next_impl(vm, global_object, vm.argument(0));
|
||||
|
|
|
@ -21,9 +21,9 @@ public:
|
|||
virtual ~GeneratorObjectPrototype() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(next);
|
||||
JS_DECLARE_NATIVE_FUNCTION(return_);
|
||||
JS_DECLARE_NATIVE_FUNCTION(throw_);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(next);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(return_);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(throw_);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -329,7 +329,7 @@ void GlobalObject::set_associated_realm(Badge<Realm>, Realm& realm)
|
|||
m_associated_realm = &realm;
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(GlobalObject::gc)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(GlobalObject::gc)
|
||||
{
|
||||
#ifdef __serenity__
|
||||
dbgln("Forced garbage collection requested!");
|
||||
|
@ -339,19 +339,19 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::gc)
|
|||
}
|
||||
|
||||
// 19.2.3 isNaN ( number ), https://tc39.es/ecma262/#sec-isnan-number
|
||||
JS_DEFINE_NATIVE_FUNCTION(GlobalObject::is_nan)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(GlobalObject::is_nan)
|
||||
{
|
||||
return Value(TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).is_nan());
|
||||
}
|
||||
|
||||
// 19.2.2 isFinite ( number ), https://tc39.es/ecma262/#sec-isfinite-number
|
||||
JS_DEFINE_NATIVE_FUNCTION(GlobalObject::is_finite)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(GlobalObject::is_finite)
|
||||
{
|
||||
return Value(TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).is_finite_number());
|
||||
}
|
||||
|
||||
// 19.2.4 parseFloat ( string ), https://tc39.es/ecma262/#sec-parsefloat-string
|
||||
JS_DEFINE_NATIVE_FUNCTION(GlobalObject::parse_float)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(GlobalObject::parse_float)
|
||||
{
|
||||
if (vm.argument(0).is_number())
|
||||
return vm.argument(0);
|
||||
|
@ -366,7 +366,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::parse_float)
|
|||
}
|
||||
|
||||
// 19.2.5 parseInt ( string, radix ), https://tc39.es/ecma262/#sec-parseint-string-radix
|
||||
JS_DEFINE_NATIVE_FUNCTION(GlobalObject::parse_int)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(GlobalObject::parse_int)
|
||||
{
|
||||
auto input_string = TRY_OR_DISCARD(vm.argument(0).to_string(global_object));
|
||||
|
||||
|
@ -424,7 +424,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::parse_int)
|
|||
}
|
||||
|
||||
// 19.2.1 eval ( x ), https://tc39.es/ecma262/#sec-eval-x
|
||||
JS_DEFINE_NATIVE_FUNCTION(GlobalObject::eval)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(GlobalObject::eval)
|
||||
{
|
||||
return TRY_OR_DISCARD(perform_eval(vm.argument(0), global_object, CallerMode::NonStrict, EvalMode::Indirect));
|
||||
}
|
||||
|
@ -499,7 +499,7 @@ static String decode(JS::GlobalObject& global_object, const String& string, Stri
|
|||
}
|
||||
|
||||
// 19.2.6.4 encodeURI ( uri ), https://tc39.es/ecma262/#sec-encodeuri-uri
|
||||
JS_DEFINE_NATIVE_FUNCTION(GlobalObject::encode_uri)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(GlobalObject::encode_uri)
|
||||
{
|
||||
auto uri_string = TRY_OR_DISCARD(vm.argument(0).to_string(global_object));
|
||||
auto encoded = encode(global_object, uri_string, ";/?:@&=+$,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.!~*'()#"sv);
|
||||
|
@ -509,7 +509,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::encode_uri)
|
|||
}
|
||||
|
||||
// 19.2.6.2 decodeURI ( encodedURI ), https://tc39.es/ecma262/#sec-decodeuri-encodeduri
|
||||
JS_DEFINE_NATIVE_FUNCTION(GlobalObject::decode_uri)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(GlobalObject::decode_uri)
|
||||
{
|
||||
auto uri_string = TRY_OR_DISCARD(vm.argument(0).to_string(global_object));
|
||||
auto decoded = decode(global_object, uri_string, ";/?:@&=+$,#"sv);
|
||||
|
@ -519,7 +519,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::decode_uri)
|
|||
}
|
||||
|
||||
// 19.2.6.5 encodeURIComponent ( uriComponent ), https://tc39.es/ecma262/#sec-encodeuricomponent-uricomponent
|
||||
JS_DEFINE_NATIVE_FUNCTION(GlobalObject::encode_uri_component)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(GlobalObject::encode_uri_component)
|
||||
{
|
||||
auto uri_string = TRY_OR_DISCARD(vm.argument(0).to_string(global_object));
|
||||
auto encoded = encode(global_object, uri_string, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.!~*'()"sv);
|
||||
|
@ -529,7 +529,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::encode_uri_component)
|
|||
}
|
||||
|
||||
// 19.2.6.3 decodeURIComponent ( encodedURIComponent ), https://tc39.es/ecma262/#sec-decodeuricomponent-encodeduricomponent
|
||||
JS_DEFINE_NATIVE_FUNCTION(GlobalObject::decode_uri_component)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(GlobalObject::decode_uri_component)
|
||||
{
|
||||
auto uri_string = TRY_OR_DISCARD(vm.argument(0).to_string(global_object));
|
||||
auto decoded = decode(global_object, uri_string, ""sv);
|
||||
|
@ -539,7 +539,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::decode_uri_component)
|
|||
}
|
||||
|
||||
// B.2.1.1 escape ( string ), https://tc39.es/ecma262/#sec-escape-string
|
||||
JS_DEFINE_NATIVE_FUNCTION(GlobalObject::escape)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(GlobalObject::escape)
|
||||
{
|
||||
auto string = TRY_OR_DISCARD(vm.argument(0).to_string(global_object));
|
||||
StringBuilder escaped;
|
||||
|
@ -557,7 +557,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::escape)
|
|||
}
|
||||
|
||||
// B.2.1.2 unescape ( string ), https://tc39.es/ecma262/#sec-unescape-string
|
||||
JS_DEFINE_NATIVE_FUNCTION(GlobalObject::unescape)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(GlobalObject::unescape)
|
||||
{
|
||||
auto string = TRY_OR_DISCARD(vm.argument(0).to_string(global_object));
|
||||
ssize_t length = string.length();
|
||||
|
|
|
@ -76,18 +76,18 @@ protected:
|
|||
private:
|
||||
virtual bool is_global_object() const final { return true; }
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(gc);
|
||||
JS_DECLARE_NATIVE_FUNCTION(is_nan);
|
||||
JS_DECLARE_NATIVE_FUNCTION(is_finite);
|
||||
JS_DECLARE_NATIVE_FUNCTION(parse_float);
|
||||
JS_DECLARE_NATIVE_FUNCTION(parse_int);
|
||||
JS_DECLARE_NATIVE_FUNCTION(eval);
|
||||
JS_DECLARE_NATIVE_FUNCTION(encode_uri);
|
||||
JS_DECLARE_NATIVE_FUNCTION(decode_uri);
|
||||
JS_DECLARE_NATIVE_FUNCTION(encode_uri_component);
|
||||
JS_DECLARE_NATIVE_FUNCTION(decode_uri_component);
|
||||
JS_DECLARE_NATIVE_FUNCTION(escape);
|
||||
JS_DECLARE_NATIVE_FUNCTION(unescape);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(gc);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(is_nan);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(is_finite);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(parse_float);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(parse_int);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(eval);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(encode_uri);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(decode_uri);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(encode_uri_component);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(decode_uri_component);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(escape);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(unescape);
|
||||
|
||||
NonnullOwnPtr<Console> m_console;
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ Value DisplayNamesConstructor::construct(FunctionObject& new_target)
|
|||
}
|
||||
|
||||
// 12.3.2 Intl.DisplayNames.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-Intl.DisplayNames.supportedLocalesOf
|
||||
JS_DEFINE_NATIVE_FUNCTION(DisplayNamesConstructor::supported_locales_of)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DisplayNamesConstructor::supported_locales_of)
|
||||
{
|
||||
auto locales = vm.argument(0);
|
||||
auto options = vm.argument(1);
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
private:
|
||||
virtual bool has_constructor() const override { return true; }
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(supported_locales_of);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(supported_locales_of);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ void DisplayNamesPrototype::initialize(GlobalObject& global_object)
|
|||
}
|
||||
|
||||
// 12.4.3 Intl.DisplayNames.prototype.of ( code ), https://tc39.es/ecma402/#sec-Intl.DisplayNames.prototype.of
|
||||
JS_DEFINE_NATIVE_FUNCTION(DisplayNamesPrototype::of)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DisplayNamesPrototype::of)
|
||||
{
|
||||
auto code = vm.argument(0);
|
||||
|
||||
|
@ -81,7 +81,7 @@ JS_DEFINE_NATIVE_FUNCTION(DisplayNamesPrototype::of)
|
|||
}
|
||||
|
||||
// 12.4.4 Intl.DisplayNames.prototype.resolvedOptions ( ), https://tc39.es/ecma402/#sec-Intl.DisplayNames.prototype.resolvedOptions
|
||||
JS_DEFINE_NATIVE_FUNCTION(DisplayNamesPrototype::resolved_options)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(DisplayNamesPrototype::resolved_options)
|
||||
{
|
||||
// 1. Let displayNames be this value.
|
||||
// 2. Perform ? RequireInternalSlot(displayNames, [[InitializedDisplayNames]]).
|
||||
|
|
|
@ -20,8 +20,8 @@ public:
|
|||
virtual ~DisplayNamesPrototype() override = default;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(of);
|
||||
JS_DECLARE_NATIVE_FUNCTION(resolved_options);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(of);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(resolved_options);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ void Intl::initialize(GlobalObject& global_object)
|
|||
}
|
||||
|
||||
// 8.3.1 Intl.getCanonicalLocales ( locales ), https://tc39.es/ecma402/#sec-intl.getcanonicallocales
|
||||
JS_DEFINE_NATIVE_FUNCTION(Intl::get_canonical_locales)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(Intl::get_canonical_locales)
|
||||
{
|
||||
auto locales = vm.argument(0);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
virtual ~Intl() override = default;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_canonical_locales);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_canonical_locales);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ Value ListFormatConstructor::construct(FunctionObject& new_target)
|
|||
}
|
||||
|
||||
// 13.3.2 Intl.ListFormat.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-Intl.ListFormat.supportedLocalesOf
|
||||
JS_DEFINE_NATIVE_FUNCTION(ListFormatConstructor::supported_locales_of)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ListFormatConstructor::supported_locales_of)
|
||||
{
|
||||
auto locales = vm.argument(0);
|
||||
auto options = vm.argument(1);
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
private:
|
||||
virtual bool has_constructor() const override { return true; }
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(supported_locales_of);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(supported_locales_of);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ void ListFormatPrototype::initialize(GlobalObject& global_object)
|
|||
}
|
||||
|
||||
// 13.4.3 Intl.ListFormat.prototype.format ( list ), https://tc39.es/ecma402/#sec-Intl.ListFormat.prototype.format
|
||||
JS_DEFINE_NATIVE_FUNCTION(ListFormatPrototype::format)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ListFormatPrototype::format)
|
||||
{
|
||||
auto list = vm.argument(0);
|
||||
|
||||
|
@ -51,7 +51,7 @@ JS_DEFINE_NATIVE_FUNCTION(ListFormatPrototype::format)
|
|||
}
|
||||
|
||||
// 13.4.4 Intl.ListFormat.prototype.formatToParts ( list ), https://tc39.es/ecma402/#sec-Intl.ListFormat.prototype.formatToParts
|
||||
JS_DEFINE_NATIVE_FUNCTION(ListFormatPrototype::format_to_parts)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ListFormatPrototype::format_to_parts)
|
||||
{
|
||||
auto list = vm.argument(0);
|
||||
|
||||
|
@ -67,7 +67,7 @@ JS_DEFINE_NATIVE_FUNCTION(ListFormatPrototype::format_to_parts)
|
|||
}
|
||||
|
||||
// 13.4.5 Intl.ListFormat.prototype.resolvedOptions ( ), https://tc39.es/ecma402/#sec-Intl.ListFormat.prototype.resolvedoptions
|
||||
JS_DEFINE_NATIVE_FUNCTION(ListFormatPrototype::resolved_options)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ListFormatPrototype::resolved_options)
|
||||
{
|
||||
// 1. Let lf be the this value.
|
||||
// 2. Perform ? RequireInternalSlot(lf, [[InitializedListFormat]]).
|
||||
|
|
|
@ -20,9 +20,9 @@ public:
|
|||
virtual ~ListFormatPrototype() override = default;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(format);
|
||||
JS_DECLARE_NATIVE_FUNCTION(format_to_parts);
|
||||
JS_DECLARE_NATIVE_FUNCTION(resolved_options);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(format);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(format_to_parts);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(resolved_options);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ void LocalePrototype::initialize(GlobalObject& global_object)
|
|||
}
|
||||
|
||||
// 14.3.3 Intl.Locale.prototype.maximize ( ), https://tc39.es/ecma402/#sec-Intl.Locale.prototype.maximize
|
||||
JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::maximize)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(LocalePrototype::maximize)
|
||||
{
|
||||
// 1. Let loc be the this value.
|
||||
// 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]).
|
||||
|
@ -63,7 +63,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::maximize)
|
|||
}
|
||||
|
||||
// 14.3.4 Intl.Locale.prototype.minimize ( ), https://tc39.es/ecma402/#sec-Intl.Locale.prototype.minimize
|
||||
JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::minimize)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(LocalePrototype::minimize)
|
||||
{
|
||||
// 1. Let loc be the this value.
|
||||
// 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]).
|
||||
|
@ -81,7 +81,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::minimize)
|
|||
}
|
||||
|
||||
// 14.3.5 Intl.Locale.prototype.toString ( ), https://tc39.es/ecma402/#sec-Intl.Locale.prototype.toString
|
||||
JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::to_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(LocalePrototype::to_string)
|
||||
{
|
||||
// 1. Let loc be the this value.
|
||||
// 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]).
|
||||
|
@ -92,7 +92,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::to_string)
|
|||
}
|
||||
|
||||
// 14.3.6 get Intl.Locale.prototype.baseName, https://tc39.es/ecma402/#sec-Intl.Locale.prototype.baseName
|
||||
JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::base_name)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(LocalePrototype::base_name)
|
||||
{
|
||||
// 1. Let loc be the this value.
|
||||
// 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]).
|
||||
|
@ -119,7 +119,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::base_name)
|
|||
// 14.3.10 get Intl.Locale.prototype.hourCycle, https://tc39.es/ecma402/#sec-Intl.Locale.prototype.hourCycle
|
||||
// 14.3.12 get Intl.Locale.prototype.numberingSystem, https://tc39.es/ecma402/#sec-Intl.Locale.prototype.numberingSystem
|
||||
#define __JS_ENUMERATE(keyword) \
|
||||
JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::keyword) \
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(LocalePrototype::keyword) \
|
||||
{ \
|
||||
auto* locale_object = TRY_OR_DISCARD(typed_this_object(global_object)); \
|
||||
if (!locale_object->has_##keyword()) \
|
||||
|
@ -130,7 +130,7 @@ JS_ENUMERATE_LOCALE_KEYWORD_PROPERTIES
|
|||
#undef __JS_ENUMERATE
|
||||
|
||||
// 14.3.11 get Intl.Locale.prototype.numeric, https://tc39.es/ecma402/#sec-Intl.Locale.prototype.numeric
|
||||
JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::numeric)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(LocalePrototype::numeric)
|
||||
{
|
||||
// 1. Let loc be the this value.
|
||||
// 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]).
|
||||
|
@ -141,7 +141,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::numeric)
|
|||
}
|
||||
|
||||
// 14.3.13 get Intl.Locale.prototype.language, https://tc39.es/ecma402/#sec-Intl.Locale.prototype.language
|
||||
JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::language)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(LocalePrototype::language)
|
||||
{
|
||||
// 1. Let loc be the this value.
|
||||
// 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]).
|
||||
|
@ -158,7 +158,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::language)
|
|||
}
|
||||
|
||||
// 14.3.14 get Intl.Locale.prototype.script, https://tc39.es/ecma402/#sec-Intl.Locale.prototype.script
|
||||
JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::script)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(LocalePrototype::script)
|
||||
{
|
||||
// 1. Let loc be the this value.
|
||||
// 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]).
|
||||
|
@ -179,7 +179,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::script)
|
|||
}
|
||||
|
||||
// 14.3.15 get Intl.Locale.prototype.region, https://tc39.es/ecma402/#sec-Intl.Locale.prototype.region
|
||||
JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::region)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(LocalePrototype::region)
|
||||
{
|
||||
// 1. Let loc be the this value.
|
||||
// 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]).
|
||||
|
|
|
@ -20,20 +20,20 @@ public:
|
|||
virtual ~LocalePrototype() override = default;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(maximize);
|
||||
JS_DECLARE_NATIVE_FUNCTION(minimize);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(maximize);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(minimize);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_string);
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(base_name);
|
||||
JS_DECLARE_NATIVE_FUNCTION(calendar);
|
||||
JS_DECLARE_NATIVE_FUNCTION(case_first);
|
||||
JS_DECLARE_NATIVE_FUNCTION(collation);
|
||||
JS_DECLARE_NATIVE_FUNCTION(hour_cycle);
|
||||
JS_DECLARE_NATIVE_FUNCTION(numbering_system);
|
||||
JS_DECLARE_NATIVE_FUNCTION(numeric);
|
||||
JS_DECLARE_NATIVE_FUNCTION(language);
|
||||
JS_DECLARE_NATIVE_FUNCTION(script);
|
||||
JS_DECLARE_NATIVE_FUNCTION(region);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(base_name);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(calendar);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(case_first);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(collation);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(hour_cycle);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(numbering_system);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(numeric);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(language);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(script);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(region);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ Value NumberFormatConstructor::construct(FunctionObject& new_target)
|
|||
}
|
||||
|
||||
// 15.3.2 Intl.NumberFormat.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-intl.numberformat.supportedlocalesof
|
||||
JS_DEFINE_NATIVE_FUNCTION(NumberFormatConstructor::supported_locales_of)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(NumberFormatConstructor::supported_locales_of)
|
||||
{
|
||||
auto locales = vm.argument(0);
|
||||
auto options = vm.argument(1);
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
private:
|
||||
virtual bool has_constructor() const override { return true; }
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(supported_locales_of);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(supported_locales_of);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ void NumberFormatPrototype::initialize(GlobalObject& global_object)
|
|||
}
|
||||
|
||||
// 15.4.5 Intl.NumberFormat.prototype.resolvedOptions ( ), https://tc39.es/ecma402/#sec-intl.numberformat.prototype.resolvedoptions
|
||||
JS_DEFINE_NATIVE_FUNCTION(NumberFormatPrototype::resolved_options)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(NumberFormatPrototype::resolved_options)
|
||||
{
|
||||
// 1. Let nf be the this value.
|
||||
// 2. If the implementation supports the normative optional constructor mode of 4.3 Note 1, then
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
virtual ~NumberFormatPrototype() override = default;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(resolved_options);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(resolved_options);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ IteratorPrototype::~IteratorPrototype()
|
|||
}
|
||||
|
||||
// 27.1.2.1 %IteratorPrototype% [ @@iterator ] ( ), https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
|
||||
JS_DEFINE_NATIVE_FUNCTION(IteratorPrototype::symbol_iterator)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(IteratorPrototype::symbol_iterator)
|
||||
{
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
return this_object;
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
virtual ~IteratorPrototype() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(symbol_iterator);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(symbol_iterator);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ String JSONObject::stringify_impl(GlobalObject& global_object, Value value, Valu
|
|||
}
|
||||
|
||||
// 25.5.2 JSON.stringify ( value [ , replacer [ , space ] ] ), https://tc39.es/ecma262/#sec-json.stringify
|
||||
JS_DEFINE_NATIVE_FUNCTION(JSONObject::stringify)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(JSONObject::stringify)
|
||||
{
|
||||
if (!vm.argument_count())
|
||||
return js_undefined();
|
||||
|
@ -375,7 +375,7 @@ String JSONObject::quote_json_string(String string)
|
|||
}
|
||||
|
||||
// 25.5.1 JSON.parse ( text [ , reviver ] ), https://tc39.es/ecma262/#sec-json.parse
|
||||
JS_DEFINE_NATIVE_FUNCTION(JSONObject::parse)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(JSONObject::parse)
|
||||
{
|
||||
auto string = TRY_OR_DISCARD(vm.argument(0).to_string(global_object));
|
||||
auto reviver = vm.argument(1);
|
||||
|
|
|
@ -44,8 +44,8 @@ private:
|
|||
static Array* parse_json_array(GlobalObject&, const JsonArray&);
|
||||
static Value internalize_json_property(GlobalObject&, Object* holder, PropertyName const& name, FunctionObject& reviver);
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(stringify);
|
||||
JS_DECLARE_NATIVE_FUNCTION(parse);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(stringify);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(parse);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ Value MapConstructor::construct(FunctionObject& new_target)
|
|||
}
|
||||
|
||||
// 24.1.2.2 get Map [ @@species ], https://tc39.es/ecma262/#sec-get-map-@@species
|
||||
JS_DEFINE_NATIVE_FUNCTION(MapConstructor::symbol_species_getter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MapConstructor::symbol_species_getter)
|
||||
{
|
||||
return vm.this_value(global_object);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
private:
|
||||
virtual bool has_constructor() const override { return true; }
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(symbol_species_getter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(symbol_species_getter);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ MapIteratorPrototype::~MapIteratorPrototype()
|
|||
}
|
||||
|
||||
// 24.1.5.2.1 %MapIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%mapiteratorprototype%.next
|
||||
JS_DEFINE_NATIVE_FUNCTION(MapIteratorPrototype::next)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MapIteratorPrototype::next)
|
||||
{
|
||||
auto* map_iterator = TRY_OR_DISCARD(typed_this_value(global_object));
|
||||
if (map_iterator->done())
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
virtual ~MapIteratorPrototype() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(next);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(next);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ MapPrototype::~MapPrototype()
|
|||
}
|
||||
|
||||
// 24.1.3.1 Map.prototype.clear ( ), https://tc39.es/ecma262/#sec-map.prototype.clear
|
||||
JS_DEFINE_NATIVE_FUNCTION(MapPrototype::clear)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MapPrototype::clear)
|
||||
{
|
||||
auto* map = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
map->entries().clear();
|
||||
|
@ -51,14 +51,14 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::clear)
|
|||
}
|
||||
|
||||
// 24.1.3.3 Map.prototype.delete ( key ), https://tc39.es/ecma262/#sec-map.prototype.delete
|
||||
JS_DEFINE_NATIVE_FUNCTION(MapPrototype::delete_)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MapPrototype::delete_)
|
||||
{
|
||||
auto* map = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
return Value(map->entries().remove(vm.argument(0)));
|
||||
}
|
||||
|
||||
// 24.1.3.4 Map.prototype.entries ( ), https://tc39.es/ecma262/#sec-map.prototype.entries
|
||||
JS_DEFINE_NATIVE_FUNCTION(MapPrototype::entries)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MapPrototype::entries)
|
||||
{
|
||||
auto* map = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -66,7 +66,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::entries)
|
|||
}
|
||||
|
||||
// 24.1.3.5 Map.prototype.forEach ( callbackfn [ , thisArg ] ), https://tc39.es/ecma262/#sec-map.prototype.foreach
|
||||
JS_DEFINE_NATIVE_FUNCTION(MapPrototype::for_each)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MapPrototype::for_each)
|
||||
{
|
||||
auto* map = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
if (!vm.argument(0).is_function()) {
|
||||
|
@ -83,7 +83,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::for_each)
|
|||
}
|
||||
|
||||
// 24.1.3.6 Map.prototype.get ( key ), https://tc39.es/ecma262/#sec-map.prototype.get
|
||||
JS_DEFINE_NATIVE_FUNCTION(MapPrototype::get)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MapPrototype::get)
|
||||
{
|
||||
auto* map = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
auto result = map->entries().get(vm.argument(0));
|
||||
|
@ -93,7 +93,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::get)
|
|||
}
|
||||
|
||||
// 24.1.3.7 Map.prototype.has ( key ), https://tc39.es/ecma262/#sec-map.prototype.has
|
||||
JS_DEFINE_NATIVE_FUNCTION(MapPrototype::has)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MapPrototype::has)
|
||||
{
|
||||
auto* map = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
auto& entries = map->entries();
|
||||
|
@ -101,7 +101,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::has)
|
|||
}
|
||||
|
||||
// 24.1.3.8 Map.prototype.keys ( ), https://tc39.es/ecma262/#sec-map.prototype.keys
|
||||
JS_DEFINE_NATIVE_FUNCTION(MapPrototype::keys)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MapPrototype::keys)
|
||||
{
|
||||
auto* map = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -109,7 +109,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::keys)
|
|||
}
|
||||
|
||||
// 24.1.3.9 Map.prototype.set ( key, value ), https://tc39.es/ecma262/#sec-map.prototype.set
|
||||
JS_DEFINE_NATIVE_FUNCTION(MapPrototype::set)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MapPrototype::set)
|
||||
{
|
||||
auto* map = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
auto key = vm.argument(0);
|
||||
|
@ -120,7 +120,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::set)
|
|||
}
|
||||
|
||||
// 24.1.3.11 Map.prototype.values ( ), https://tc39.es/ecma262/#sec-map.prototype.values
|
||||
JS_DEFINE_NATIVE_FUNCTION(MapPrototype::values)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MapPrototype::values)
|
||||
{
|
||||
auto* map = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -128,7 +128,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::values)
|
|||
}
|
||||
|
||||
// 24.1.3.10 get Map.prototype.size, https://tc39.es/ecma262/#sec-get-map.prototype.size
|
||||
JS_DEFINE_NATIVE_FUNCTION(MapPrototype::size_getter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MapPrototype::size_getter)
|
||||
{
|
||||
auto* map = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
return Value(map->entries().size());
|
||||
|
|
|
@ -20,17 +20,17 @@ public:
|
|||
virtual ~MapPrototype() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(clear);
|
||||
JS_DECLARE_NATIVE_FUNCTION(delete_);
|
||||
JS_DECLARE_NATIVE_FUNCTION(entries);
|
||||
JS_DECLARE_NATIVE_FUNCTION(for_each);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get);
|
||||
JS_DECLARE_NATIVE_FUNCTION(has);
|
||||
JS_DECLARE_NATIVE_FUNCTION(keys);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set);
|
||||
JS_DECLARE_NATIVE_FUNCTION(values);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(clear);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(delete_);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(entries);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(for_each);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(has);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(keys);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(values);
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(size_getter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(size_getter);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ MathObject::~MathObject()
|
|||
}
|
||||
|
||||
// 21.3.2.1 Math.abs ( x ), https://tc39.es/ecma262/#sec-math.abs
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::abs)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::abs)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_nan())
|
||||
|
@ -92,14 +92,14 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::abs)
|
|||
}
|
||||
|
||||
// 21.3.2.27 Math.random ( ), https://tc39.es/ecma262/#sec-math.random
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::random)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::random)
|
||||
{
|
||||
double r = (double)get_random<u32>() / (double)UINT32_MAX;
|
||||
return Value(r);
|
||||
}
|
||||
|
||||
// 21.3.2.32 Math.sqrt ( x ), https://tc39.es/ecma262/#sec-math.sqrt
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::sqrt)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::sqrt)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_nan())
|
||||
|
@ -108,7 +108,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::sqrt)
|
|||
}
|
||||
|
||||
// 21.3.2.16 Math.floor ( x ), https://tc39.es/ecma262/#sec-math.floor
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::floor)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::floor)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_nan())
|
||||
|
@ -117,7 +117,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::floor)
|
|||
}
|
||||
|
||||
// 21.3.2.10 Math.ceil ( x ), https://tc39.es/ecma262/#sec-math.ceil
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::ceil)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::ceil)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_nan())
|
||||
|
@ -129,7 +129,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::ceil)
|
|||
}
|
||||
|
||||
// 21.3.2.28 Math.round ( x ), https://tc39.es/ecma262/#sec-math.round
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::round)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::round)
|
||||
{
|
||||
auto value = TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double();
|
||||
double integer = ::ceil(value);
|
||||
|
@ -139,7 +139,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::round)
|
|||
}
|
||||
|
||||
// 21.3.2.24 Math.max ( ...args ), https://tc39.es/ecma262/#sec-math.max
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::max)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::max)
|
||||
{
|
||||
Vector<Value> coerced;
|
||||
for (size_t i = 0; i < vm.argument_count(); ++i)
|
||||
|
@ -156,7 +156,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::max)
|
|||
}
|
||||
|
||||
// 21.3.2.25 Math.min ( ...args ), https://tc39.es/ecma262/#sec-math.min
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::min)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::min)
|
||||
{
|
||||
Vector<Value> coerced;
|
||||
for (size_t i = 0; i < vm.argument_count(); ++i)
|
||||
|
@ -173,7 +173,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::min)
|
|||
}
|
||||
|
||||
// 21.3.2.35 Math.trunc ( x ), https://tc39.es/ecma262/#sec-math.trunc
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::trunc)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::trunc)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_nan())
|
||||
|
@ -184,7 +184,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::trunc)
|
|||
}
|
||||
|
||||
// 21.3.2.30 Math.sin ( x ), https://tc39.es/ecma262/#sec-math.sin
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::sin)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::sin)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_nan())
|
||||
|
@ -193,7 +193,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::sin)
|
|||
}
|
||||
|
||||
// 21.3.2.12 Math.cos ( x ), https://tc39.es/ecma262/#sec-math.cos
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::cos)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::cos)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_nan())
|
||||
|
@ -202,7 +202,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::cos)
|
|||
}
|
||||
|
||||
// 21.3.2.33 Math.tan ( x ), https://tc39.es/ecma262/#sec-math.tan
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::tan)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::tan)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_nan())
|
||||
|
@ -211,7 +211,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::tan)
|
|||
}
|
||||
|
||||
// 21.3.2.26 Math.pow ( base, exponent ), https://tc39.es/ecma262/#sec-math.pow
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::pow)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::pow)
|
||||
{
|
||||
auto base = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
auto exponent = TRY_OR_DISCARD(vm.argument(1).to_number(global_object));
|
||||
|
@ -265,7 +265,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::pow)
|
|||
}
|
||||
|
||||
// 21.3.2.14 Math.exp ( x ), https://tc39.es/ecma262/#sec-math.exp
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::exp)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::exp)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_nan())
|
||||
|
@ -274,7 +274,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::exp)
|
|||
}
|
||||
|
||||
// 21.3.2.15 Math.expm1 ( x ), https://tc39.es/ecma262/#sec-math.expm1
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::expm1)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::expm1)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_nan())
|
||||
|
@ -283,7 +283,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::expm1)
|
|||
}
|
||||
|
||||
// 21.3.2.29 Math.sign ( x ), https://tc39.es/ecma262/#sec-math.sign
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::sign)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::sign)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_positive_zero())
|
||||
|
@ -298,7 +298,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::sign)
|
|||
}
|
||||
|
||||
// 21.3.2.11 Math.clz32 ( x ), https://tc39.es/ecma262/#sec-math.clz32
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::clz32)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::clz32)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_u32(global_object));
|
||||
if (number == 0)
|
||||
|
@ -307,7 +307,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::clz32)
|
|||
}
|
||||
|
||||
// 21.3.2.2 Math.acos ( x ), https://tc39.es/ecma262/#sec-math.acos
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::acos)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::acos)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_nan() || number.as_double() > 1 || number.as_double() < -1)
|
||||
|
@ -318,7 +318,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::acos)
|
|||
}
|
||||
|
||||
// 21.3.2.3 Math.acosh ( x ), https://tc39.es/ecma262/#sec-math.acosh
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::acosh)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::acosh)
|
||||
{
|
||||
auto value = TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double();
|
||||
if (value < 1)
|
||||
|
@ -327,7 +327,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::acosh)
|
|||
}
|
||||
|
||||
// 21.3.2.4 Math.asin ( x ), https://tc39.es/ecma262/#sec-math.asin
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::asin)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::asin)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_nan() || number.is_positive_zero() || number.is_negative_zero())
|
||||
|
@ -336,13 +336,13 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::asin)
|
|||
}
|
||||
|
||||
// 21.3.2.5 Math.asinh ( x ), https://tc39.es/ecma262/#sec-math.asinh
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::asinh)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::asinh)
|
||||
{
|
||||
return Value(::asinh(TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double()));
|
||||
}
|
||||
|
||||
// 21.3.2.6 Math.atan ( x ), https://tc39.es/ecma262/#sec-math.atan
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::atan)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::atan)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_nan() || number.is_positive_zero() || number.is_negative_zero())
|
||||
|
@ -355,7 +355,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::atan)
|
|||
}
|
||||
|
||||
// 21.3.2.7 Math.atanh ( x ), https://tc39.es/ecma262/#sec-math.atanh
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::atanh)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::atanh)
|
||||
{
|
||||
auto value = TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double();
|
||||
if (value > 1 || value < -1)
|
||||
|
@ -364,7 +364,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::atanh)
|
|||
}
|
||||
|
||||
// 21.3.2.21 Math.log1p ( x ), https://tc39.es/ecma262/#sec-math.log1p
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::log1p)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::log1p)
|
||||
{
|
||||
auto value = TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double();
|
||||
if (value < -1)
|
||||
|
@ -373,13 +373,13 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::log1p)
|
|||
}
|
||||
|
||||
// 21.3.2.9 Math.cbrt ( x ), https://tc39.es/ecma262/#sec-math.cbrt
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::cbrt)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::cbrt)
|
||||
{
|
||||
return Value(::cbrt(TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double()));
|
||||
}
|
||||
|
||||
// 21.3.2.8 Math.atan2 ( y, x ), https://tc39.es/ecma262/#sec-math.atan2
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::atan2)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::atan2)
|
||||
{
|
||||
auto constexpr three_quarters_pi = M_PI_4 + M_PI_2;
|
||||
|
||||
|
@ -438,7 +438,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::atan2)
|
|||
}
|
||||
|
||||
// 21.3.2.17 Math.fround ( x ), https://tc39.es/ecma262/#sec-math.fround
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::fround)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::fround)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_nan())
|
||||
|
@ -447,7 +447,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::fround)
|
|||
}
|
||||
|
||||
// 21.3.2.18 Math.hypot ( ...args ), https://tc39.es/ecma262/#sec-math.hypot
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::hypot)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::hypot)
|
||||
{
|
||||
Vector<Value> coerced;
|
||||
for (size_t i = 0; i < vm.argument_count(); ++i)
|
||||
|
@ -475,7 +475,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::hypot)
|
|||
}
|
||||
|
||||
// 21.3.2.19 Math.imul ( x, y ), https://tc39.es/ecma262/#sec-math.imul
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::imul)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::imul)
|
||||
{
|
||||
auto a = TRY_OR_DISCARD(vm.argument(0).to_u32(global_object));
|
||||
auto b = TRY_OR_DISCARD(vm.argument(1).to_u32(global_object));
|
||||
|
@ -483,7 +483,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::imul)
|
|||
}
|
||||
|
||||
// 21.3.2.20 Math.log ( x ), https://tc39.es/ecma262/#sec-math.log
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::log)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::log)
|
||||
{
|
||||
auto value = TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double();
|
||||
if (value < 0)
|
||||
|
@ -492,7 +492,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::log)
|
|||
}
|
||||
|
||||
// 21.3.2.23 Math.log2 ( x ), https://tc39.es/ecma262/#sec-math.log2
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::log2)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::log2)
|
||||
{
|
||||
auto value = TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double();
|
||||
if (value < 0)
|
||||
|
@ -501,7 +501,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::log2)
|
|||
}
|
||||
|
||||
// 21.3.2.22 Math.log10 ( x ), https://tc39.es/ecma262/#sec-math.log10
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::log10)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::log10)
|
||||
{
|
||||
auto value = TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double();
|
||||
if (value < 0)
|
||||
|
@ -510,7 +510,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::log10)
|
|||
}
|
||||
|
||||
// 21.3.2.31 Math.sinh ( x ), https://tc39.es/ecma262/#sec-math.sinh
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::sinh)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::sinh)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_nan())
|
||||
|
@ -519,7 +519,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::sinh)
|
|||
}
|
||||
|
||||
// 21.3.2.13 Math.cosh ( x ), https://tc39.es/ecma262/#sec-math.cosh
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::cosh)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::cosh)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_nan())
|
||||
|
@ -528,7 +528,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::cosh)
|
|||
}
|
||||
|
||||
// 21.3.2.34 Math.tanh ( x ), https://tc39.es/ecma262/#sec-math.tanh
|
||||
JS_DEFINE_NATIVE_FUNCTION(MathObject::tanh)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::tanh)
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
|
||||
if (number.is_nan())
|
||||
|
|
|
@ -19,41 +19,41 @@ public:
|
|||
virtual ~MathObject() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(abs);
|
||||
JS_DECLARE_NATIVE_FUNCTION(random);
|
||||
JS_DECLARE_NATIVE_FUNCTION(sqrt);
|
||||
JS_DECLARE_NATIVE_FUNCTION(floor);
|
||||
JS_DECLARE_NATIVE_FUNCTION(ceil);
|
||||
JS_DECLARE_NATIVE_FUNCTION(round);
|
||||
JS_DECLARE_NATIVE_FUNCTION(max);
|
||||
JS_DECLARE_NATIVE_FUNCTION(min);
|
||||
JS_DECLARE_NATIVE_FUNCTION(trunc);
|
||||
JS_DECLARE_NATIVE_FUNCTION(sin);
|
||||
JS_DECLARE_NATIVE_FUNCTION(cos);
|
||||
JS_DECLARE_NATIVE_FUNCTION(tan);
|
||||
JS_DECLARE_NATIVE_FUNCTION(pow);
|
||||
JS_DECLARE_NATIVE_FUNCTION(exp);
|
||||
JS_DECLARE_NATIVE_FUNCTION(expm1);
|
||||
JS_DECLARE_NATIVE_FUNCTION(sign);
|
||||
JS_DECLARE_NATIVE_FUNCTION(clz32);
|
||||
JS_DECLARE_NATIVE_FUNCTION(acos);
|
||||
JS_DECLARE_NATIVE_FUNCTION(acosh);
|
||||
JS_DECLARE_NATIVE_FUNCTION(asin);
|
||||
JS_DECLARE_NATIVE_FUNCTION(asinh);
|
||||
JS_DECLARE_NATIVE_FUNCTION(atan);
|
||||
JS_DECLARE_NATIVE_FUNCTION(atanh);
|
||||
JS_DECLARE_NATIVE_FUNCTION(log1p);
|
||||
JS_DECLARE_NATIVE_FUNCTION(cbrt);
|
||||
JS_DECLARE_NATIVE_FUNCTION(atan2);
|
||||
JS_DECLARE_NATIVE_FUNCTION(fround);
|
||||
JS_DECLARE_NATIVE_FUNCTION(hypot);
|
||||
JS_DECLARE_NATIVE_FUNCTION(imul);
|
||||
JS_DECLARE_NATIVE_FUNCTION(log);
|
||||
JS_DECLARE_NATIVE_FUNCTION(log2);
|
||||
JS_DECLARE_NATIVE_FUNCTION(log10);
|
||||
JS_DECLARE_NATIVE_FUNCTION(sinh);
|
||||
JS_DECLARE_NATIVE_FUNCTION(cosh);
|
||||
JS_DECLARE_NATIVE_FUNCTION(tanh);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(abs);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(random);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(sqrt);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(floor);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(ceil);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(round);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(max);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(min);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(trunc);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(sin);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(cos);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(tan);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(pow);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(exp);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(expm1);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(sign);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(clz32);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(acos);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(acosh);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(asin);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(asinh);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(atan);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(atanh);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(log1p);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(cbrt);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(atan2);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(fround);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(hypot);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(imul);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(log);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(log2);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(log10);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(sinh);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(cosh);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(tanh);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -105,25 +105,25 @@ Value NumberConstructor::construct(FunctionObject& new_target)
|
|||
}
|
||||
|
||||
// 21.1.2.2 Number.isFinite ( number ), https://tc39.es/ecma262/#sec-number.isfinite
|
||||
JS_DEFINE_NATIVE_FUNCTION(NumberConstructor::is_finite)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(NumberConstructor::is_finite)
|
||||
{
|
||||
return Value(vm.argument(0).is_finite_number());
|
||||
}
|
||||
|
||||
// 21.1.2.3 Number.isInteger ( number ), https://tc39.es/ecma262/#sec-number.isinteger
|
||||
JS_DEFINE_NATIVE_FUNCTION(NumberConstructor::is_integer)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(NumberConstructor::is_integer)
|
||||
{
|
||||
return Value(vm.argument(0).is_integral_number());
|
||||
}
|
||||
|
||||
// 21.1.2.4 Number.isNaN ( number ), https://tc39.es/ecma262/#sec-number.isnan
|
||||
JS_DEFINE_NATIVE_FUNCTION(NumberConstructor::is_nan)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(NumberConstructor::is_nan)
|
||||
{
|
||||
return Value(vm.argument(0).is_nan());
|
||||
}
|
||||
|
||||
// 21.1.2.5 Number.isSafeInteger ( number ), https://tc39.es/ecma262/#sec-number.issafeinteger
|
||||
JS_DEFINE_NATIVE_FUNCTION(NumberConstructor::is_safe_integer)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(NumberConstructor::is_safe_integer)
|
||||
{
|
||||
if (!vm.argument(0).is_number())
|
||||
return Value(false);
|
||||
|
|
|
@ -24,10 +24,10 @@ public:
|
|||
private:
|
||||
virtual bool has_constructor() const override { return true; }
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(is_finite);
|
||||
JS_DECLARE_NATIVE_FUNCTION(is_integer);
|
||||
JS_DECLARE_NATIVE_FUNCTION(is_nan);
|
||||
JS_DECLARE_NATIVE_FUNCTION(is_safe_integer);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(is_finite);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(is_integer);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(is_nan);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(is_safe_integer);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ static ThrowCompletionOr<Value> this_number_value(GlobalObject& global_object, V
|
|||
}
|
||||
|
||||
// 21.1.3.3 Number.prototype.toFixed ( fractionDigits ), https://tc39.es/ecma262/#sec-number.prototype.tofixed
|
||||
JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_fixed)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(NumberPrototype::to_fixed)
|
||||
{
|
||||
auto number_value = TRY_OR_DISCARD(this_number_value(global_object, vm.this_value(global_object)));
|
||||
auto fraction_digits = TRY_OR_DISCARD(vm.argument(0).to_integer_or_infinity(global_object));
|
||||
|
@ -82,7 +82,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_fixed)
|
|||
}
|
||||
|
||||
// 21.1.3.6 Number.prototype.toString ( [ radix ] ), https://tc39.es/ecma262/#sec-number.prototype.tostring
|
||||
JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(NumberPrototype::to_string)
|
||||
{
|
||||
auto number_value = TRY_OR_DISCARD(this_number_value(global_object, vm.this_value(global_object)));
|
||||
double radix_argument = 10;
|
||||
|
@ -154,7 +154,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_string)
|
|||
}
|
||||
|
||||
// 21.1.3.7 Number.prototype.valueOf ( ), https://tc39.es/ecma262/#sec-number.prototype.valueof
|
||||
JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::value_of)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(NumberPrototype::value_of)
|
||||
{
|
||||
return TRY_OR_DISCARD(this_number_value(global_object, vm.this_value(global_object)));
|
||||
}
|
||||
|
|
|
@ -18,9 +18,9 @@ public:
|
|||
virtual void initialize(GlobalObject&) override;
|
||||
virtual ~NumberPrototype() override;
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_fixed);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(value_of);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_fixed);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(value_of);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -114,21 +114,21 @@ static Array* get_own_property_keys(GlobalObject& global_object, Value value, Ge
|
|||
}
|
||||
|
||||
// 20.1.2.10 Object.getOwnPropertyNames ( O ), https://tc39.es/ecma262/#sec-object.getownpropertynames
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_names)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::get_own_property_names)
|
||||
{
|
||||
// 1. Return ? GetOwnPropertyKeys(O, string).
|
||||
return get_own_property_keys(global_object, vm.argument(0), GetOwnPropertyKeysType::String);
|
||||
}
|
||||
|
||||
// 20.1.2.11 Object.getOwnPropertySymbols ( O ), https://tc39.es/ecma262/#sec-object.getownpropertysymbols
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_symbols)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::get_own_property_symbols)
|
||||
{
|
||||
// 1. Return ? GetOwnPropertyKeys(O, symbol).
|
||||
return get_own_property_keys(global_object, vm.argument(0), GetOwnPropertyKeysType::Symbol);
|
||||
}
|
||||
|
||||
// 20.1.2.12 Object.getPrototypeOf ( O ), https://tc39.es/ecma262/#sec-object.getprototypeof
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_prototype_of)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::get_prototype_of)
|
||||
{
|
||||
// 1. Let obj be ? ToObject(O).
|
||||
auto* object = TRY_OR_DISCARD(vm.argument(0).to_object(global_object));
|
||||
|
@ -138,7 +138,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_prototype_of)
|
|||
}
|
||||
|
||||
// 20.1.2.21 Object.setPrototypeOf ( O, proto ), https://tc39.es/ecma262/#sec-object.setprototypeof
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::set_prototype_of)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::set_prototype_of)
|
||||
{
|
||||
auto proto = vm.argument(1);
|
||||
|
||||
|
@ -170,7 +170,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::set_prototype_of)
|
|||
}
|
||||
|
||||
// 20.1.2.14 Object.isExtensible ( O ), https://tc39.es/ecma262/#sec-object.isextensible
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::is_extensible)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::is_extensible)
|
||||
{
|
||||
auto argument = vm.argument(0);
|
||||
if (!argument.is_object())
|
||||
|
@ -179,7 +179,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::is_extensible)
|
|||
}
|
||||
|
||||
// 20.1.2.15 Object.isFrozen ( O ), https://tc39.es/ecma262/#sec-object.isfrozen
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::is_frozen)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::is_frozen)
|
||||
{
|
||||
auto argument = vm.argument(0);
|
||||
if (!argument.is_object())
|
||||
|
@ -188,7 +188,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::is_frozen)
|
|||
}
|
||||
|
||||
// 20.1.2.16 Object.isSealed ( O ), https://tc39.es/ecma262/#sec-object.issealed
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::is_sealed)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::is_sealed)
|
||||
{
|
||||
auto argument = vm.argument(0);
|
||||
if (!argument.is_object())
|
||||
|
@ -197,7 +197,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::is_sealed)
|
|||
}
|
||||
|
||||
// 20.1.2.18 Object.preventExtensions ( O ), https://tc39.es/ecma262/#sec-object.preventextensions
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::prevent_extensions)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::prevent_extensions)
|
||||
{
|
||||
auto argument = vm.argument(0);
|
||||
if (!argument.is_object())
|
||||
|
@ -212,7 +212,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::prevent_extensions)
|
|||
}
|
||||
|
||||
// 20.1.2.6 Object.freeze ( O ), https://tc39.es/ecma262/#sec-object.freeze
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::freeze)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::freeze)
|
||||
{
|
||||
auto argument = vm.argument(0);
|
||||
if (!argument.is_object())
|
||||
|
@ -226,7 +226,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::freeze)
|
|||
}
|
||||
|
||||
// 20.1.2.7 Object.fromEntries ( iterable ), https://tc39.es/ecma262/#sec-object.fromentries
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::from_entries)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::from_entries)
|
||||
{
|
||||
auto iterable = TRY_OR_DISCARD(require_object_coercible(global_object, vm.argument(0)));
|
||||
|
||||
|
@ -261,7 +261,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::from_entries)
|
|||
}
|
||||
|
||||
// 20.1.2.20 Object.seal ( O ), https://tc39.es/ecma262/#sec-object.seal
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::seal)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::seal)
|
||||
{
|
||||
auto argument = vm.argument(0);
|
||||
if (!argument.is_object())
|
||||
|
@ -275,7 +275,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::seal)
|
|||
}
|
||||
|
||||
// 20.1.2.8 Object.getOwnPropertyDescriptor ( O, P ), https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_descriptor)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::get_own_property_descriptor)
|
||||
{
|
||||
auto* object = TRY_OR_DISCARD(vm.argument(0).to_object(global_object));
|
||||
auto key = TRY_OR_DISCARD(vm.argument(1).to_property_key(global_object));
|
||||
|
@ -284,7 +284,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_descriptor)
|
|||
}
|
||||
|
||||
// 20.1.2.9 Object.getOwnPropertyDescriptors ( O ), https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_descriptors)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::get_own_property_descriptors)
|
||||
{
|
||||
// 1. Let obj be ? ToObject(O).
|
||||
auto* object = TRY_OR_DISCARD(vm.argument(0).to_object(global_object));
|
||||
|
@ -315,7 +315,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_descriptors)
|
|||
}
|
||||
|
||||
// 20.1.2.4 Object.defineProperty ( O, P, Attributes ), https://tc39.es/ecma262/#sec-object.defineproperty
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::define_property)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::define_property)
|
||||
{
|
||||
if (!vm.argument(0).is_object()) {
|
||||
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObject, vm.argument(0).to_string_without_side_effects());
|
||||
|
@ -328,7 +328,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::define_property)
|
|||
}
|
||||
|
||||
// 20.1.2.3 Object.defineProperties ( O, Properties ), https://tc39.es/ecma262/#sec-object.defineproperties
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::define_properties)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::define_properties)
|
||||
{
|
||||
auto object = vm.argument(0);
|
||||
auto properties = vm.argument(1);
|
||||
|
@ -344,13 +344,13 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::define_properties)
|
|||
}
|
||||
|
||||
// 20.1.2.13 Object.is ( value1, value2 ), https://tc39.es/ecma262/#sec-object.is
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::is)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::is)
|
||||
{
|
||||
return Value(same_value(vm.argument(0), vm.argument(1)));
|
||||
}
|
||||
|
||||
// 20.1.2.17 Object.keys ( O ), https://tc39.es/ecma262/#sec-object.keys
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::keys)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::keys)
|
||||
{
|
||||
auto* object = TRY_OR_DISCARD(vm.argument(0).to_object(global_object));
|
||||
auto name_list = TRY_OR_DISCARD(object->enumerable_own_property_names(PropertyKind::Key));
|
||||
|
@ -358,7 +358,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::keys)
|
|||
}
|
||||
|
||||
// 20.1.2.22 Object.values ( O ), https://tc39.es/ecma262/#sec-object.values
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::values)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::values)
|
||||
{
|
||||
auto* object = TRY_OR_DISCARD(vm.argument(0).to_object(global_object));
|
||||
auto name_list = TRY_OR_DISCARD(object->enumerable_own_property_names(PropertyKind::Value));
|
||||
|
@ -366,7 +366,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::values)
|
|||
}
|
||||
|
||||
// 20.1.2.5 Object.entries ( O ), https://tc39.es/ecma262/#sec-object.entries
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::entries)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::entries)
|
||||
{
|
||||
auto* object = TRY_OR_DISCARD(vm.argument(0).to_object(global_object));
|
||||
auto name_list = TRY_OR_DISCARD(object->enumerable_own_property_names(PropertyKind::KeyAndValue));
|
||||
|
@ -374,7 +374,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::entries)
|
|||
}
|
||||
|
||||
// 20.1.2.2 Object.create ( O, Properties ), https://tc39.es/ecma262/#sec-object.create
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::create)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::create)
|
||||
{
|
||||
auto proto = vm.argument(0);
|
||||
auto properties = vm.argument(1);
|
||||
|
@ -399,7 +399,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::create)
|
|||
}
|
||||
|
||||
// 1 Object.hasOwn ( O, P ), https://tc39.es/proposal-accessible-object-hasownproperty/#sec-object.hasown
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::has_own)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::has_own)
|
||||
{
|
||||
// 1. Let obj be ? ToObject(O).
|
||||
auto* object = TRY_OR_DISCARD(vm.argument(0).to_object(global_object));
|
||||
|
@ -412,7 +412,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::has_own)
|
|||
}
|
||||
|
||||
// 20.1.2.1 Object.assign ( target, ...sources ), https://tc39.es/ecma262/#sec-object.assign
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::assign)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::assign)
|
||||
{
|
||||
// 1. Let to be ? ToObject(target).
|
||||
auto* to = TRY_OR_DISCARD(vm.argument(0).to_object(global_object));
|
||||
|
|
|
@ -25,28 +25,28 @@ public:
|
|||
private:
|
||||
virtual bool has_constructor() const override { return true; }
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(define_property);
|
||||
JS_DECLARE_NATIVE_FUNCTION(define_properties);
|
||||
JS_DECLARE_NATIVE_FUNCTION(is);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_own_property_descriptor);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_own_property_descriptors);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_own_property_names);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_own_property_symbols);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_prototype_of);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_prototype_of);
|
||||
JS_DECLARE_NATIVE_FUNCTION(is_extensible);
|
||||
JS_DECLARE_NATIVE_FUNCTION(is_frozen);
|
||||
JS_DECLARE_NATIVE_FUNCTION(is_sealed);
|
||||
JS_DECLARE_NATIVE_FUNCTION(prevent_extensions);
|
||||
JS_DECLARE_NATIVE_FUNCTION(seal);
|
||||
JS_DECLARE_NATIVE_FUNCTION(freeze);
|
||||
JS_DECLARE_NATIVE_FUNCTION(from_entries);
|
||||
JS_DECLARE_NATIVE_FUNCTION(keys);
|
||||
JS_DECLARE_NATIVE_FUNCTION(values);
|
||||
JS_DECLARE_NATIVE_FUNCTION(entries);
|
||||
JS_DECLARE_NATIVE_FUNCTION(create);
|
||||
JS_DECLARE_NATIVE_FUNCTION(has_own);
|
||||
JS_DECLARE_NATIVE_FUNCTION(assign);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(define_property);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(define_properties);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(is);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_own_property_descriptor);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_own_property_descriptors);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_own_property_names);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_own_property_symbols);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_prototype_of);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_prototype_of);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(is_extensible);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(is_frozen);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(is_sealed);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(prevent_extensions);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(seal);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(freeze);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(from_entries);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(keys);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(values);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(entries);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(create);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(has_own);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(assign);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ ThrowCompletionOr<bool> ObjectPrototype::internal_set_prototype_of(Object* proto
|
|||
}
|
||||
|
||||
// 20.1.3.2 Object.prototype.hasOwnProperty ( V ), https://tc39.es/ecma262/#sec-object.prototype.hasownproperty
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::has_own_property)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectPrototype::has_own_property)
|
||||
{
|
||||
auto property_key = TRY_OR_DISCARD(vm.argument(0).to_property_key(global_object));
|
||||
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
@ -68,7 +68,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::has_own_property)
|
|||
}
|
||||
|
||||
// 20.1.3.6 Object.prototype.toString ( ), https://tc39.es/ecma262/#sec-object.prototype.tostring
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectPrototype::to_string)
|
||||
{
|
||||
auto this_value = vm.this_value(global_object);
|
||||
|
||||
|
@ -136,20 +136,20 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_string)
|
|||
}
|
||||
|
||||
// 20.1.3.5 Object.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ), https://tc39.es/ecma262/#sec-object.prototype.tolocalestring
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_locale_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectPrototype::to_locale_string)
|
||||
{
|
||||
auto this_value = vm.this_value(global_object);
|
||||
return TRY_OR_DISCARD(this_value.invoke(global_object, vm.names.toString));
|
||||
}
|
||||
|
||||
// 20.1.3.7 Object.prototype.valueOf ( ), https://tc39.es/ecma262/#sec-object.prototype.valueof
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::value_of)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectPrototype::value_of)
|
||||
{
|
||||
return TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
}
|
||||
|
||||
// 20.1.3.4 Object.prototype.propertyIsEnumerable ( V ), https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::property_is_enumerable)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectPrototype::property_is_enumerable)
|
||||
{
|
||||
// 1. Let P be ? ToPropertyKey(V).
|
||||
auto property_key = TRY_OR_DISCARD(vm.argument(0).to_property_key(global_object));
|
||||
|
@ -165,7 +165,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::property_is_enumerable)
|
|||
}
|
||||
|
||||
// 20.1.3.3 Object.prototype.isPrototypeOf ( V ), https://tc39.es/ecma262/#sec-object.prototype.isprototypeof
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::is_prototype_of)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectPrototype::is_prototype_of)
|
||||
{
|
||||
auto object_argument = vm.argument(0);
|
||||
if (!object_argument.is_object())
|
||||
|
@ -183,7 +183,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::is_prototype_of)
|
|||
}
|
||||
|
||||
// B.2.2.2 Object.prototype.__defineGetter__ ( P, getter ), https://tc39.es/ecma262/#sec-object.prototype.__defineGetter__
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::define_getter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectPrototype::define_getter)
|
||||
{
|
||||
auto* object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -203,7 +203,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::define_getter)
|
|||
}
|
||||
|
||||
// B.2.2.3 Object.prototype.__defineSetter__ ( P, getter ), https://tc39.es/ecma262/#sec-object.prototype.__defineSetter__
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::define_setter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectPrototype::define_setter)
|
||||
{
|
||||
auto* object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -223,7 +223,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::define_setter)
|
|||
}
|
||||
|
||||
// B.2.2.4 Object.prototype.__lookupGetter__ ( P ), https://tc39.es/ecma262/#sec-object.prototype.__lookupGetter__
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::lookup_getter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectPrototype::lookup_getter)
|
||||
{
|
||||
auto* object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -243,7 +243,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::lookup_getter)
|
|||
}
|
||||
|
||||
// B.2.2.5 Object.prototype.__lookupSetter__ ( P ), https://tc39.es/ecma262/#sec-object.prototype.__lookupSetter__
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::lookup_setter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectPrototype::lookup_setter)
|
||||
{
|
||||
auto* object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -263,14 +263,14 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::lookup_setter)
|
|||
}
|
||||
|
||||
// B.2.2.1.1 get Object.prototype.__proto__, https://tc39.es/ecma262/#sec-get-object.prototype.__proto__
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::proto_getter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectPrototype::proto_getter)
|
||||
{
|
||||
auto* object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
return TRY_OR_DISCARD(object->internal_get_prototype_of());
|
||||
}
|
||||
|
||||
// B.2.2.1.2 set Object.prototype.__proto__, https://tc39.es/ecma262/#sec-set-object.prototype.__proto__
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::proto_setter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectPrototype::proto_setter)
|
||||
{
|
||||
auto object = TRY_OR_DISCARD(require_object_coercible(global_object, vm.this_value(global_object)));
|
||||
|
||||
|
|
|
@ -24,20 +24,20 @@ public:
|
|||
virtual ThrowCompletionOr<bool> internal_set_prototype_of(Object* prototype) override;
|
||||
|
||||
// public to serve as intrinsic function %Object.prototype.toString%
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_string);
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(has_own_property);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_locale_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(value_of);
|
||||
JS_DECLARE_NATIVE_FUNCTION(property_is_enumerable);
|
||||
JS_DECLARE_NATIVE_FUNCTION(is_prototype_of);
|
||||
JS_DECLARE_NATIVE_FUNCTION(define_getter);
|
||||
JS_DECLARE_NATIVE_FUNCTION(define_setter);
|
||||
JS_DECLARE_NATIVE_FUNCTION(lookup_getter);
|
||||
JS_DECLARE_NATIVE_FUNCTION(lookup_setter);
|
||||
JS_DECLARE_NATIVE_FUNCTION(proto_getter);
|
||||
JS_DECLARE_NATIVE_FUNCTION(proto_setter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(has_own_property);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_locale_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(value_of);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(property_is_enumerable);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(is_prototype_of);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(define_getter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(define_setter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(lookup_getter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(lookup_setter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(proto_getter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(proto_setter);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ Value PromiseConstructor::construct(FunctionObject& new_target)
|
|||
}
|
||||
|
||||
// 27.2.4.1 Promise.all ( iterable ), https://tc39.es/ecma262/#sec-promise.all
|
||||
JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::all)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(PromiseConstructor::all)
|
||||
{
|
||||
auto* constructor = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -302,7 +302,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::all)
|
|||
}
|
||||
|
||||
// 27.2.4.2 Promise.allSettled ( iterable ), https://tc39.es/ecma262/#sec-promise.allsettled
|
||||
JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::all_settled)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(PromiseConstructor::all_settled)
|
||||
{
|
||||
auto* constructor = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -331,7 +331,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::all_settled)
|
|||
}
|
||||
|
||||
// 27.2.4.3 Promise.any ( iterable ), https://tc39.es/ecma262/#sec-promise.any
|
||||
JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::any)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(PromiseConstructor::any)
|
||||
{
|
||||
auto* constructor = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -360,7 +360,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::any)
|
|||
}
|
||||
|
||||
// 27.2.4.5 Promise.race ( iterable ), https://tc39.es/ecma262/#sec-promise.race
|
||||
JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::race)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(PromiseConstructor::race)
|
||||
{
|
||||
auto* constructor = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
|
@ -389,7 +389,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::race)
|
|||
}
|
||||
|
||||
// 27.2.4.6 Promise.reject ( r ), https://tc39.es/ecma262/#sec-promise.reject
|
||||
JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::reject)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(PromiseConstructor::reject)
|
||||
{
|
||||
auto* constructor = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
auto promise_capability = new_promise_capability(global_object, constructor);
|
||||
|
@ -401,7 +401,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::reject)
|
|||
}
|
||||
|
||||
// 27.2.4.7 Promise.resolve ( x ), https://tc39.es/ecma262/#sec-promise.resolve
|
||||
JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::resolve)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(PromiseConstructor::resolve)
|
||||
{
|
||||
auto* constructor = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
auto value = vm.argument(0);
|
||||
|
@ -409,7 +409,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::resolve)
|
|||
}
|
||||
|
||||
// 27.2.4.8 get Promise [ @@species ], https://tc39.es/ecma262/#sec-get-promise-@@species
|
||||
JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::symbol_species_getter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(PromiseConstructor::symbol_species_getter)
|
||||
{
|
||||
return vm.this_value(global_object);
|
||||
}
|
||||
|
|
|
@ -24,14 +24,14 @@ public:
|
|||
private:
|
||||
virtual bool has_constructor() const override { return true; }
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(all);
|
||||
JS_DECLARE_NATIVE_FUNCTION(all_settled);
|
||||
JS_DECLARE_NATIVE_FUNCTION(any);
|
||||
JS_DECLARE_NATIVE_FUNCTION(race);
|
||||
JS_DECLARE_NATIVE_FUNCTION(reject);
|
||||
JS_DECLARE_NATIVE_FUNCTION(resolve);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(all);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(all_settled);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(any);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(race);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(reject);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(resolve);
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(symbol_species_getter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(symbol_species_getter);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ void PromisePrototype::initialize(GlobalObject& global_object)
|
|||
}
|
||||
|
||||
// 27.2.5.4 Promise.prototype.then ( onFulfilled, onRejected ), https://tc39.es/ecma262/#sec-promise.prototype.then
|
||||
JS_DEFINE_NATIVE_FUNCTION(PromisePrototype::then)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(PromisePrototype::then)
|
||||
{
|
||||
auto* promise = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
auto on_fulfilled = vm.argument(0);
|
||||
|
@ -49,7 +49,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromisePrototype::then)
|
|||
}
|
||||
|
||||
// 27.2.5.1 Promise.prototype.catch ( onRejected ), https://tc39.es/ecma262/#sec-promise.prototype.catch
|
||||
JS_DEFINE_NATIVE_FUNCTION(PromisePrototype::catch_)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(PromisePrototype::catch_)
|
||||
{
|
||||
auto this_value = vm.this_value(global_object);
|
||||
auto on_rejected = vm.argument(0);
|
||||
|
@ -57,7 +57,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromisePrototype::catch_)
|
|||
}
|
||||
|
||||
// 27.2.5.3 Promise.prototype.finally ( onFinally ), https://tc39.es/ecma262/#sec-promise.prototype.finally
|
||||
JS_DEFINE_NATIVE_FUNCTION(PromisePrototype::finally)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(PromisePrototype::finally)
|
||||
{
|
||||
auto* promise = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
|
||||
auto* constructor = TRY_OR_DISCARD(species_constructor(global_object, *promise, *global_object.promise_constructor()));
|
||||
|
|
|
@ -19,9 +19,9 @@ public:
|
|||
virtual ~PromisePrototype() override = default;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(then);
|
||||
JS_DECLARE_NATIVE_FUNCTION(catch_);
|
||||
JS_DECLARE_NATIVE_FUNCTION(finally);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(then);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(catch_);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(finally);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ Value ProxyConstructor::construct(FunctionObject&)
|
|||
}
|
||||
|
||||
// 28.2.2.1 Proxy.revocable ( target, handler ), https://tc39.es/ecma262/#sec-proxy.revocable
|
||||
JS_DEFINE_NATIVE_FUNCTION(ProxyConstructor::revocable)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ProxyConstructor::revocable)
|
||||
{
|
||||
auto* proxy = proxy_create(global_object, vm.argument(0), vm.argument(1));
|
||||
if (vm.exception())
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
private:
|
||||
virtual bool has_constructor() const override { return true; }
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(revocable);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(revocable);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ ReflectObject::~ReflectObject()
|
|||
}
|
||||
|
||||
// 28.1.1 Reflect.apply ( target, thisArgument, argumentsList ), https://tc39.es/ecma262/#sec-reflect.apply
|
||||
JS_DEFINE_NATIVE_FUNCTION(ReflectObject::apply)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ReflectObject::apply)
|
||||
{
|
||||
auto target = vm.argument(0);
|
||||
auto this_argument = vm.argument(1);
|
||||
|
@ -69,7 +69,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::apply)
|
|||
}
|
||||
|
||||
// 28.1.2 Reflect.construct ( target, argumentsList [ , newTarget ] ), https://tc39.es/ecma262/#sec-reflect.construct
|
||||
JS_DEFINE_NATIVE_FUNCTION(ReflectObject::construct)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ReflectObject::construct)
|
||||
{
|
||||
auto target = vm.argument(0);
|
||||
auto arguments_list = vm.argument(1);
|
||||
|
@ -99,7 +99,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::construct)
|
|||
}
|
||||
|
||||
// 28.1.3 Reflect.defineProperty ( target, propertyKey, attributes ), https://tc39.es/ecma262/#sec-reflect.defineproperty
|
||||
JS_DEFINE_NATIVE_FUNCTION(ReflectObject::define_property)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ReflectObject::define_property)
|
||||
{
|
||||
auto target = vm.argument(0);
|
||||
auto property_key = vm.argument(1);
|
||||
|
@ -122,7 +122,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::define_property)
|
|||
}
|
||||
|
||||
// 28.1.4 Reflect.deleteProperty ( target, propertyKey ), https://tc39.es/ecma262/#sec-reflect.deleteproperty
|
||||
JS_DEFINE_NATIVE_FUNCTION(ReflectObject::delete_property)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ReflectObject::delete_property)
|
||||
{
|
||||
auto target = vm.argument(0);
|
||||
auto property_key = vm.argument(1);
|
||||
|
@ -141,7 +141,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::delete_property)
|
|||
}
|
||||
|
||||
// 28.1.5 Reflect.get ( target, propertyKey [ , receiver ] ), https://tc39.es/ecma262/#sec-reflect.get
|
||||
JS_DEFINE_NATIVE_FUNCTION(ReflectObject::get)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ReflectObject::get)
|
||||
{
|
||||
auto target = vm.argument(0);
|
||||
auto property_key = vm.argument(1);
|
||||
|
@ -167,7 +167,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::get)
|
|||
}
|
||||
|
||||
// 28.1.6 Reflect.getOwnPropertyDescriptor ( target, propertyKey ), https://tc39.es/ecma262/#sec-reflect.getownpropertydescriptor
|
||||
JS_DEFINE_NATIVE_FUNCTION(ReflectObject::get_own_property_descriptor)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ReflectObject::get_own_property_descriptor)
|
||||
{
|
||||
auto target = vm.argument(0);
|
||||
auto property_key = vm.argument(1);
|
||||
|
@ -189,7 +189,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::get_own_property_descriptor)
|
|||
}
|
||||
|
||||
// 28.1.7 Reflect.getPrototypeOf ( target ), https://tc39.es/ecma262/#sec-reflect.getprototypeof
|
||||
JS_DEFINE_NATIVE_FUNCTION(ReflectObject::get_prototype_of)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ReflectObject::get_prototype_of)
|
||||
{
|
||||
auto target = vm.argument(0);
|
||||
|
||||
|
@ -204,7 +204,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::get_prototype_of)
|
|||
}
|
||||
|
||||
// 28.1.8 Reflect.has ( target, propertyKey ), https://tc39.es/ecma262/#sec-reflect.has
|
||||
JS_DEFINE_NATIVE_FUNCTION(ReflectObject::has)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ReflectObject::has)
|
||||
{
|
||||
auto target = vm.argument(0);
|
||||
auto property_key = vm.argument(1);
|
||||
|
@ -223,7 +223,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::has)
|
|||
}
|
||||
|
||||
// 28.1.9 Reflect.isExtensible ( target ), https://tc39.es/ecma262/#sec-reflect.isextensible
|
||||
JS_DEFINE_NATIVE_FUNCTION(ReflectObject::is_extensible)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ReflectObject::is_extensible)
|
||||
{
|
||||
auto target = vm.argument(0);
|
||||
|
||||
|
@ -238,7 +238,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::is_extensible)
|
|||
}
|
||||
|
||||
// 28.1.10 Reflect.ownKeys ( target ), https://tc39.es/ecma262/#sec-reflect.ownkeys
|
||||
JS_DEFINE_NATIVE_FUNCTION(ReflectObject::own_keys)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ReflectObject::own_keys)
|
||||
{
|
||||
auto target = vm.argument(0);
|
||||
|
||||
|
@ -256,7 +256,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::own_keys)
|
|||
}
|
||||
|
||||
// 28.1.11 Reflect.preventExtensions ( target ), https://tc39.es/ecma262/#sec-reflect.preventextensions
|
||||
JS_DEFINE_NATIVE_FUNCTION(ReflectObject::prevent_extensions)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ReflectObject::prevent_extensions)
|
||||
{
|
||||
auto target = vm.argument(0);
|
||||
|
||||
|
@ -271,7 +271,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::prevent_extensions)
|
|||
}
|
||||
|
||||
// 28.1.12 Reflect.set ( target, propertyKey, V [ , receiver ] ), https://tc39.es/ecma262/#sec-reflect.set
|
||||
JS_DEFINE_NATIVE_FUNCTION(ReflectObject::set)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ReflectObject::set)
|
||||
{
|
||||
auto target = vm.argument(0);
|
||||
auto property_key = vm.argument(1);
|
||||
|
@ -298,7 +298,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::set)
|
|||
}
|
||||
|
||||
// 28.1.13 Reflect.setPrototypeOf ( target, proto ), https://tc39.es/ecma262/#sec-reflect.setprototypeof
|
||||
JS_DEFINE_NATIVE_FUNCTION(ReflectObject::set_prototype_of)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ReflectObject::set_prototype_of)
|
||||
{
|
||||
auto target = vm.argument(0);
|
||||
auto proto = vm.argument(1);
|
||||
|
|
|
@ -19,19 +19,19 @@ public:
|
|||
virtual ~ReflectObject() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(apply);
|
||||
JS_DECLARE_NATIVE_FUNCTION(construct);
|
||||
JS_DECLARE_NATIVE_FUNCTION(define_property);
|
||||
JS_DECLARE_NATIVE_FUNCTION(delete_property);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_own_property_descriptor);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_prototype_of);
|
||||
JS_DECLARE_NATIVE_FUNCTION(has);
|
||||
JS_DECLARE_NATIVE_FUNCTION(is_extensible);
|
||||
JS_DECLARE_NATIVE_FUNCTION(own_keys);
|
||||
JS_DECLARE_NATIVE_FUNCTION(prevent_extensions);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_prototype_of);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(apply);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(construct);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(define_property);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(delete_property);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_own_property_descriptor);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(get_prototype_of);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(has);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(is_extensible);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(own_keys);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(prevent_extensions);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(set_prototype_of);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ Value RegExpConstructor::construct(FunctionObject&)
|
|||
}
|
||||
|
||||
// 22.2.4.2 get RegExp [ @@species ], https://tc39.es/ecma262/#sec-get-regexp-@@species
|
||||
JS_DEFINE_NATIVE_FUNCTION(RegExpConstructor::symbol_species_getter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(RegExpConstructor::symbol_species_getter)
|
||||
{
|
||||
return vm.this_value(global_object);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
private:
|
||||
virtual bool has_constructor() const override { return true; }
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(symbol_species_getter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(symbol_species_getter);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -280,7 +280,7 @@ Value regexp_exec(GlobalObject& global_object, Object& regexp_object, Utf16Strin
|
|||
// 22.2.5.14 get RegExp.prototype.sticky, https://tc39.es/ecma262/#sec-get-regexp.prototype.sticky
|
||||
// 22.2.5.17 get RegExp.prototype.unicode, https://tc39.es/ecma262/#sec-get-regexp.prototype.unicode
|
||||
#define __JS_ENUMERATE(flagName, flag_name, flag_char) \
|
||||
JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::flag_name) \
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(RegExpPrototype::flag_name) \
|
||||
{ \
|
||||
auto* regexp_object = TRY_OR_DISCARD(this_object(global_object)); \
|
||||
if (!is<RegExpObject>(regexp_object)) { \
|
||||
|
@ -297,7 +297,7 @@ JS_ENUMERATE_REGEXP_FLAGS
|
|||
#undef __JS_ENUMERATE
|
||||
|
||||
// 22.2.5.4 get RegExp.prototype.flags, https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
|
||||
JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::flags)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(RegExpPrototype::flags)
|
||||
{
|
||||
auto* regexp_object = TRY_OR_DISCARD(this_object(global_object));
|
||||
StringBuilder builder(8);
|
||||
|
@ -313,7 +313,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::flags)
|
|||
}
|
||||
|
||||
// 22.2.5.12 get RegExp.prototype.source, https://tc39.es/ecma262/#sec-get-regexp.prototype.source
|
||||
JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::source)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(RegExpPrototype::source)
|
||||
{
|
||||
auto* regexp_object = TRY_OR_DISCARD(this_object(global_object));
|
||||
if (!is<RegExpObject>(regexp_object)) {
|
||||
|
@ -327,7 +327,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::source)
|
|||
}
|
||||
|
||||
// 22.2.5.2 RegExp.prototype.exec ( string ), https://tc39.es/ecma262/#sec-regexp.prototype.exec
|
||||
JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::exec)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(RegExpPrototype::exec)
|
||||
{
|
||||
auto* regexp_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -337,7 +337,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::exec)
|
|||
}
|
||||
|
||||
// 22.2.5.15 RegExp.prototype.test ( S ), https://tc39.es/ecma262/#sec-regexp.prototype.test
|
||||
JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::test)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(RegExpPrototype::test)
|
||||
{
|
||||
auto* regexp_object = TRY_OR_DISCARD(this_object(global_object));
|
||||
auto string = TRY_OR_DISCARD(vm.argument(0).to_utf16_string(global_object));
|
||||
|
@ -350,7 +350,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::test)
|
|||
}
|
||||
|
||||
// 22.2.5.16 RegExp.prototype.toString ( ), https://tc39.es/ecma262/#sec-regexp.prototype.tostring
|
||||
JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::to_string)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(RegExpPrototype::to_string)
|
||||
{
|
||||
auto* regexp_object = TRY_OR_DISCARD(this_object(global_object));
|
||||
auto source_attr = TRY_OR_DISCARD(regexp_object->get(vm.names.source));
|
||||
|
@ -363,7 +363,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::to_string)
|
|||
}
|
||||
|
||||
// 22.2.5.7 RegExp.prototype [ @@match ] ( string ), https://tc39.es/ecma262/#sec-regexp.prototype-@@match
|
||||
JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_match)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(RegExpPrototype::symbol_match)
|
||||
{
|
||||
auto* regexp_object = TRY_OR_DISCARD(this_object(global_object));
|
||||
auto string = TRY_OR_DISCARD(vm.argument(0).to_utf16_string(global_object));
|
||||
|
@ -412,7 +412,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_match)
|
|||
}
|
||||
|
||||
// 22.2.5.8 RegExp.prototype [ @@matchAll ] ( string ), https://tc39.es/ecma262/#sec-regexp-prototype-matchall
|
||||
JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_match_all)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(RegExpPrototype::symbol_match_all)
|
||||
{
|
||||
auto* regexp_object = TRY_OR_DISCARD(this_object(global_object));
|
||||
auto string = TRY_OR_DISCARD(vm.argument(0).to_utf16_string(global_object));
|
||||
|
@ -441,7 +441,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_match_all)
|
|||
}
|
||||
|
||||
// 22.2.5.10 RegExp.prototype [ @@replace ] ( string, replaceValue ), https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
|
||||
JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(RegExpPrototype::symbol_replace)
|
||||
{
|
||||
auto string_value = vm.argument(0);
|
||||
auto replace_value = vm.argument(1);
|
||||
|
@ -553,7 +553,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace)
|
|||
}
|
||||
|
||||
// 22.2.5.11 RegExp.prototype [ @@search ] ( string ), https://tc39.es/ecma262/#sec-regexp.prototype-@@search
|
||||
JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_search)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(RegExpPrototype::symbol_search)
|
||||
{
|
||||
auto* regexp_object = TRY_OR_DISCARD(this_object(global_object));
|
||||
auto string = TRY_OR_DISCARD(vm.argument(0).to_utf16_string(global_object));
|
||||
|
@ -578,7 +578,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_search)
|
|||
}
|
||||
|
||||
// 22.2.5.13 RegExp.prototype [ @@split ] ( string, limit ), https://tc39.es/ecma262/#sec-regexp.prototype-@@split
|
||||
JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_split)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(RegExpPrototype::symbol_split)
|
||||
{
|
||||
auto* regexp_object = TRY_OR_DISCARD(this_object(global_object));
|
||||
auto string = TRY_OR_DISCARD(vm.argument(0).to_utf16_string(global_object));
|
||||
|
@ -670,7 +670,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_split)
|
|||
}
|
||||
|
||||
// B.2.4.1 RegExp.prototype.compile ( pattern, flags ), https://tc39.es/ecma262/#sec-regexp.prototype.compile
|
||||
JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::compile)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(RegExpPrototype::compile)
|
||||
{
|
||||
auto* regexp_object = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
|
|
@ -24,21 +24,21 @@ public:
|
|||
virtual ~RegExpPrototype() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(flags);
|
||||
JS_DECLARE_NATIVE_FUNCTION(source);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(flags);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(source);
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(exec);
|
||||
JS_DECLARE_NATIVE_FUNCTION(test);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_NATIVE_FUNCTION(symbol_match);
|
||||
JS_DECLARE_NATIVE_FUNCTION(symbol_match_all);
|
||||
JS_DECLARE_NATIVE_FUNCTION(symbol_replace);
|
||||
JS_DECLARE_NATIVE_FUNCTION(symbol_search);
|
||||
JS_DECLARE_NATIVE_FUNCTION(symbol_split);
|
||||
JS_DECLARE_NATIVE_FUNCTION(compile);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(exec);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(test);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(to_string);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(symbol_match);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(symbol_match_all);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(symbol_replace);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(symbol_search);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(symbol_split);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(compile);
|
||||
|
||||
#define __JS_ENUMERATE(_, flag_name, ...) \
|
||||
JS_DECLARE_NATIVE_FUNCTION(flag_name);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(flag_name);
|
||||
JS_ENUMERATE_REGEXP_FLAGS
|
||||
#undef __JS_ENUMERATE
|
||||
};
|
||||
|
|
|
@ -30,7 +30,7 @@ void RegExpStringIteratorPrototype::initialize(GlobalObject& global_object)
|
|||
}
|
||||
|
||||
// 22.2.7.2.1 %RegExpStringIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%regexpstringiteratorprototype%.next
|
||||
JS_DEFINE_NATIVE_FUNCTION(RegExpStringIteratorPrototype::next)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(RegExpStringIteratorPrototype::next)
|
||||
{
|
||||
// For details, see the 'closure' of: https://tc39.es/ecma262/#sec-createregexpstringiterator
|
||||
auto* iterator = TRY_OR_DISCARD(typed_this_value(global_object));
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
virtual void initialize(GlobalObject&) override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(next);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(next);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ Value SetConstructor::construct(FunctionObject& new_target)
|
|||
}
|
||||
|
||||
// 24.2.2.2 get Set [ @@species ], https://tc39.es/ecma262/#sec-get-set-@@species
|
||||
JS_DEFINE_NATIVE_FUNCTION(SetConstructor::symbol_species_getter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(SetConstructor::symbol_species_getter)
|
||||
{
|
||||
return vm.this_value(global_object);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
private:
|
||||
virtual bool has_constructor() const override { return true; }
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(symbol_species_getter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(symbol_species_getter);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ SetIteratorPrototype::~SetIteratorPrototype()
|
|||
}
|
||||
|
||||
// 24.2.5.2.1 %SetIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%setiteratorprototype%.next
|
||||
JS_DEFINE_NATIVE_FUNCTION(SetIteratorPrototype::next)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(SetIteratorPrototype::next)
|
||||
{
|
||||
auto* set_iterator = TRY_OR_DISCARD(typed_this_value(global_object));
|
||||
if (set_iterator->done())
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
virtual ~SetIteratorPrototype() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(next);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(next);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ SetPrototype::~SetPrototype()
|
|||
}
|
||||
|
||||
// 24.2.3.1 Set.prototype.add ( value ), https://tc39.es/ecma262/#sec-set.prototype.add
|
||||
JS_DEFINE_NATIVE_FUNCTION(SetPrototype::add)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(SetPrototype::add)
|
||||
{
|
||||
auto* set = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
auto value = vm.argument(0);
|
||||
|
@ -56,7 +56,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetPrototype::add)
|
|||
}
|
||||
|
||||
// 24.2.3.2 Set.prototype.clear ( ), https://tc39.es/ecma262/#sec-set.prototype.clear
|
||||
JS_DEFINE_NATIVE_FUNCTION(SetPrototype::clear)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(SetPrototype::clear)
|
||||
{
|
||||
auto* set = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
set->values().clear();
|
||||
|
@ -64,14 +64,14 @@ JS_DEFINE_NATIVE_FUNCTION(SetPrototype::clear)
|
|||
}
|
||||
|
||||
// 24.2.3.4 Set.prototype.delete ( value ), https://tc39.es/ecma262/#sec-set.prototype.delete
|
||||
JS_DEFINE_NATIVE_FUNCTION(SetPrototype::delete_)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(SetPrototype::delete_)
|
||||
{
|
||||
auto* set = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
return Value(set->values().remove(vm.argument(0)));
|
||||
}
|
||||
|
||||
// 24.2.3.5 Set.prototype.entries ( ), https://tc39.es/ecma262/#sec-set.prototype.entries
|
||||
JS_DEFINE_NATIVE_FUNCTION(SetPrototype::entries)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(SetPrototype::entries)
|
||||
{
|
||||
auto* set = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -79,7 +79,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetPrototype::entries)
|
|||
}
|
||||
|
||||
// 24.2.3.6 Set.prototype.forEach ( callbackfn [ , thisArg ] ), https://tc39.es/ecma262/#sec-set.prototype.foreach
|
||||
JS_DEFINE_NATIVE_FUNCTION(SetPrototype::for_each)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(SetPrototype::for_each)
|
||||
{
|
||||
auto* set = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
if (!vm.argument(0).is_function()) {
|
||||
|
@ -96,7 +96,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetPrototype::for_each)
|
|||
}
|
||||
|
||||
// 24.2.3.7 Set.prototype.has ( value ), https://tc39.es/ecma262/#sec-set.prototype.has
|
||||
JS_DEFINE_NATIVE_FUNCTION(SetPrototype::has)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(SetPrototype::has)
|
||||
{
|
||||
auto* set = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
auto& values = set->values();
|
||||
|
@ -104,7 +104,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetPrototype::has)
|
|||
}
|
||||
|
||||
// 24.2.3.10 Set.prototype.values ( ), https://tc39.es/ecma262/#sec-set.prototype.values
|
||||
JS_DEFINE_NATIVE_FUNCTION(SetPrototype::values)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(SetPrototype::values)
|
||||
{
|
||||
auto* set = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
|
||||
|
@ -112,7 +112,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetPrototype::values)
|
|||
}
|
||||
|
||||
// 24.2.3.9 get Set.prototype.size, https://tc39.es/ecma262/#sec-get-set.prototype.size
|
||||
JS_DEFINE_NATIVE_FUNCTION(SetPrototype::size_getter)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(SetPrototype::size_getter)
|
||||
{
|
||||
auto* set = TRY_OR_DISCARD(typed_this_object(global_object));
|
||||
return Value(set->values().size());
|
||||
|
|
|
@ -20,15 +20,15 @@ public:
|
|||
virtual ~SetPrototype() override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(add);
|
||||
JS_DECLARE_NATIVE_FUNCTION(clear);
|
||||
JS_DECLARE_NATIVE_FUNCTION(delete_);
|
||||
JS_DECLARE_NATIVE_FUNCTION(entries);
|
||||
JS_DECLARE_NATIVE_FUNCTION(for_each);
|
||||
JS_DECLARE_NATIVE_FUNCTION(has);
|
||||
JS_DECLARE_NATIVE_FUNCTION(values);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(add);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(clear);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(delete_);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(entries);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(for_each);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(has);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(values);
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(size_getter);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(size_getter);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ void ShadowRealmPrototype::initialize(GlobalObject& global_object)
|
|||
}
|
||||
|
||||
// 3.4.1 ShadowRealm.prototype.evaluate ( sourceText ), https://tc39.es/proposal-shadowrealm/#sec-shadowrealm.prototype.evaluate
|
||||
JS_DEFINE_NATIVE_FUNCTION(ShadowRealmPrototype::evaluate)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ShadowRealmPrototype::evaluate)
|
||||
{
|
||||
auto source_text = vm.argument(0);
|
||||
|
||||
|
@ -55,7 +55,7 @@ JS_DEFINE_NATIVE_FUNCTION(ShadowRealmPrototype::evaluate)
|
|||
}
|
||||
|
||||
// 3.4.2 ShadowRealm.prototype.importValue ( specifier, exportName ), https://tc39.es/proposal-shadowrealm/#sec-shadowrealm.prototype.importvalue
|
||||
JS_DEFINE_NATIVE_FUNCTION(ShadowRealmPrototype::import_value)
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ShadowRealmPrototype::import_value)
|
||||
{
|
||||
auto specifier = vm.argument(0);
|
||||
auto export_name = vm.argument(1);
|
||||
|
|
|
@ -20,8 +20,8 @@ public:
|
|||
virtual ~ShadowRealmPrototype() override = default;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(evaluate);
|
||||
JS_DECLARE_NATIVE_FUNCTION(import_value);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(evaluate);
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(import_value);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue