1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

LibJS: Use ErrorType::NotAnObjectOfType instead of NotA

This commit is contained in:
Timothy Flynn 2021-09-11 15:01:40 -04:00 committed by Andreas Kling
parent 9def17d4cb
commit 470262c8ab
Notes: sideshowbarker 2024-07-18 04:14:25 +09:00
40 changed files with 67 additions and 67 deletions

View file

@ -38,7 +38,7 @@ TESTJS_GLOBAL_FUNCTION(get_weak_set_size, getWeakSetSize)
if (!object)
return {};
if (!is<JS::WeakSet>(object)) {
vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "WeakSet");
vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WeakSet");
return {};
}
auto* weak_set = static_cast<JS::WeakSet*>(object);
@ -51,7 +51,7 @@ TESTJS_GLOBAL_FUNCTION(get_weak_map_size, getWeakMapSize)
if (!object)
return {};
if (!is<JS::WeakMap>(object)) {
vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "WeakMap");
vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WeakMap");
return {};
}
auto* weak_map = static_cast<JS::WeakMap*>(object);

View file

@ -40,7 +40,7 @@ static ArrayBuffer* array_buffer_object_from(VM& vm, GlobalObject& global_object
// ArrayBuffer.prototype.* deliberately don't coerce |this| value to object.
auto this_value = vm.this_value(global_object);
if (!this_value.is_object() || !is<ArrayBuffer>(this_value.as_object())) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotAn, "ArrayBuffer");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "ArrayBuffer");
return nullptr;
}
return static_cast<ArrayBuffer*>(&this_value.as_object());

View file

@ -41,7 +41,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayIteratorPrototype::next)
{
auto this_value = vm.this_value(global_object);
if (!this_value.is_object() || !is<ArrayIterator>(this_value.as_object())) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotAn, "Array Iterator");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Array Iterator");
return {};
}
auto& this_object = this_value.as_object();

View file

@ -43,7 +43,7 @@ static Value this_bigint_value(GlobalObject& global_object, Value value)
if (value.is_object() && is<BigIntObject>(value.as_object()))
return &static_cast<BigIntObject&>(value.as_object()).bigint();
auto& vm = global_object.vm();
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "BigInt");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "BigInt");
return {};
}

View file

@ -37,7 +37,7 @@ JS_DEFINE_NATIVE_FUNCTION(BooleanPrototype::to_string)
if (this_value.is_boolean())
return js_string(vm, this_value.as_bool() ? "true" : "false");
if (!this_value.is_object() || !is<BooleanObject>(this_value.as_object())) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Boolean");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Boolean");
return {};
}
@ -52,7 +52,7 @@ JS_DEFINE_NATIVE_FUNCTION(BooleanPrototype::value_of)
if (this_value.is_boolean())
return this_value;
if (!this_value.is_object() || !is<BooleanObject>(this_value.as_object())) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Boolean");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Boolean");
return {};
}

View file

@ -58,7 +58,7 @@ static DataView* typed_this(VM& vm, GlobalObject& global_object)
{
auto this_value = vm.this_value(global_object);
if (!this_value.is_object() || !is<DataView>(this_value.as_object())) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, vm.names.DataView);
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, vm.names.DataView);
return nullptr;
}
return static_cast<DataView*>(&this_value.as_object());

View file

@ -27,7 +27,7 @@ static Date* typed_this(VM& vm, GlobalObject& global_object)
if (!this_object)
return nullptr;
if (!is<Date>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Date");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Date");
return nullptr;
}
return static_cast<Date*>(this_object);

View file

@ -38,7 +38,7 @@ FinalizationRegistry* FinalizationRegistryPrototype::typed_this(VM& vm, GlobalOb
if (!this_object)
return nullptr;
if (!is<FinalizationRegistry>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "FinalizationRegistry");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "FinalizationRegistry");
return nullptr;
}
return static_cast<FinalizationRegistry*>(this_object);

View file

@ -49,7 +49,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::apply)
if (!this_object)
return {};
if (!this_object->is_function()) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Function");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Function");
return {};
}
auto& function = static_cast<FunctionObject&>(*this_object);
@ -70,7 +70,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::bind)
if (!this_object)
return {};
if (!this_object->is_function()) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Function");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Function");
return {};
}
auto& this_function = static_cast<FunctionObject&>(*this_object);
@ -92,7 +92,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::call)
if (!this_object)
return {};
if (!this_object->is_function()) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Function");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Function");
return {};
}
auto& function = static_cast<FunctionObject&>(*this_object);
@ -112,7 +112,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::to_string)
if (!this_object)
return {};
if (!this_object->is_function()) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Function");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Function");
return {};
}
String function_name;

View file

@ -16,7 +16,7 @@ static GeneratorObject* typed_this(VM& vm, GlobalObject& global_object)
if (!this_object)
return {};
if (!is<GeneratorObject>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Generator");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Generator");
return nullptr;
}
return static_cast<GeneratorObject*>(this_object);

View file

@ -22,7 +22,7 @@ static DisplayNames* typed_this(GlobalObject& global_object)
return nullptr;
if (!is<DisplayNames>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Intl.DisplayNames");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Intl.DisplayNames");
return nullptr;
}

View file

@ -28,7 +28,7 @@ static ListFormat* typed_this(GlobalObject& global_object)
return nullptr;
if (!is<ListFormat>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Intl.ListFormat");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Intl.ListFormat");
return nullptr;
}

View file

@ -21,7 +21,7 @@ static Locale* typed_this(GlobalObject& global_object)
return nullptr;
if (!is<Locale>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Intl.Locale");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Intl.Locale");
return nullptr;
}

View file

@ -20,7 +20,7 @@ static NumberFormat* typed_this(GlobalObject& global_object)
return nullptr;
if (!is<NumberFormat>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Intl.NumberFormat");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Intl.NumberFormat");
return nullptr;
}

View file

@ -37,7 +37,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapIteratorPrototype::next)
{
auto this_value = vm.this_value(global_object);
if (!this_value.is_object() || !is<MapIterator>(this_value.as_object())) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Map Iterator");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Map Iterator");
return {};
}

View file

@ -48,7 +48,7 @@ Map* MapPrototype::typed_this(VM& vm, GlobalObject& global_object)
if (!this_object)
return {};
if (!is<Map>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Map");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Map");
return nullptr;
}
return static_cast<Map*>(this_object);

View file

@ -52,7 +52,7 @@ static Value this_number_value(GlobalObject& global_object, Value value)
if (value.is_object() && is<NumberObject>(value.as_object()))
return static_cast<NumberObject&>(value.as_object()).value_of();
auto& vm = global_object.vm();
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Number");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Number");
return {};
}

View file

@ -41,7 +41,7 @@ static Promise* promise_from(VM& vm, GlobalObject& global_object)
if (!this_object)
return nullptr;
if (!is<Promise>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, vm.names.Promise);
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, vm.names.Promise);
return nullptr;
}
return static_cast<Promise*>(this_object);

View file

@ -72,7 +72,7 @@ static RegExpObject* regexp_object_from(VM& vm, GlobalObject& global_object)
if (!this_object)
return nullptr;
if (!is<RegExpObject>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "RegExp");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "RegExp");
return nullptr;
}
return static_cast<RegExpObject*>(this_object);
@ -325,7 +325,7 @@ Value regexp_exec(GlobalObject& global_object, Object& regexp_object, Utf16Strin
}
if (!is<RegExpObject>(regexp_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "RegExp");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "RegExp");
return {};
}
@ -339,22 +339,22 @@ Value regexp_exec(GlobalObject& global_object, Object& regexp_object, Utf16Strin
// 22.2.5.9 get RegExp.prototype.multiline, https://tc39.es/ecma262/#sec-get-regexp.prototype.multiline
// 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_GETTER(RegExpPrototype::flag_name) \
{ \
auto* regexp_object = this_object_from(vm, global_object); \
if (!regexp_object) \
return {}; \
\
if (!is<RegExpObject>(regexp_object)) { \
if (same_value(regexp_object, global_object.regexp_prototype())) \
return js_undefined(); \
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "RegExp"); \
return {}; \
} \
\
auto const& flags = static_cast<RegExpObject*>(regexp_object)->flags(); \
return Value(flags.contains(#flag_char##sv)); \
#define __JS_ENUMERATE(flagName, flag_name, flag_char) \
JS_DEFINE_NATIVE_GETTER(RegExpPrototype::flag_name) \
{ \
auto* regexp_object = this_object_from(vm, global_object); \
if (!regexp_object) \
return {}; \
\
if (!is<RegExpObject>(regexp_object)) { \
if (same_value(regexp_object, global_object.regexp_prototype())) \
return js_undefined(); \
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "RegExp"); \
return {}; \
} \
\
auto const& flags = static_cast<RegExpObject*>(regexp_object)->flags(); \
return Value(flags.contains(#flag_char##sv)); \
}
JS_ENUMERATE_REGEXP_FLAGS
#undef __JS_ENUMERATE
@ -390,7 +390,7 @@ JS_DEFINE_NATIVE_GETTER(RegExpPrototype::source)
if (!is<RegExpObject>(regexp_object)) {
if (same_value(regexp_object, global_object.regexp_prototype()))
return js_string(vm, "(?:)");
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "RegExp");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "RegExp");
return {};
}

View file

@ -36,7 +36,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpStringIteratorPrototype::next)
// For details, see the 'closure' of: https://tc39.es/ecma262/#sec-createregexpstringiterator
auto this_value = vm.this_value(global_object);
if (!this_value.is_object() || !is<RegExpStringIterator>(this_value.as_object())) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "RegExp String Iterator");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "RegExp String Iterator");
return {};
}

View file

@ -39,7 +39,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetIteratorPrototype::next)
{
auto this_value = vm.this_value(global_object);
if (!this_value.is_object() || !is<SetIterator>(this_value.as_object())) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Set Iterator");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Set Iterator");
return {};
}

View file

@ -50,7 +50,7 @@ Set* SetPrototype::typed_this(VM& vm, GlobalObject& global_object)
if (!this_object)
return {};
if (!is<Set>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Set");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Set");
return nullptr;
}
return static_cast<Set*>(this_object);

View file

@ -38,7 +38,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringIteratorPrototype::next)
{
auto this_value = vm.this_value(global_object);
if (!this_value.is_object() || !is<StringIterator>(this_value.as_object())) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "String Iterator");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "String Iterator");
return {};
}

View file

@ -175,7 +175,7 @@ static Value this_string_value(GlobalObject& global_object, Value value)
if (value.is_object() && is<StringObject>(value.as_object()))
return static_cast<StringObject&>(value.as_object()).value_of();
auto& vm = global_object.vm();
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "String");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "String");
return {};
}

View file

@ -48,7 +48,7 @@ static Value this_symbol_value(GlobalObject& global_object, Value value)
if (value.is_object() && is<SymbolObject>(value.as_object()))
return static_cast<SymbolObject&>(value.as_object()).value_of();
auto& vm = global_object.vm();
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Symbol");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Symbol");
return {};
}

View file

@ -456,7 +456,7 @@ PlainDate* date_from_fields(GlobalObject& global_object, Object& calendar, Objec
if (!date_object)
return {};
if (!is<PlainDate>(date_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.PlainDate");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainDate");
return {};
}
@ -486,7 +486,7 @@ PlainYearMonth* year_month_from_fields(GlobalObject& global_object, Object& cale
if (!year_month_object)
return {};
if (!is<PlainYearMonth>(year_month_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.PlainYearMonth");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainYearMonth");
return {};
}
@ -516,7 +516,7 @@ PlainMonthDay* month_day_from_fields(GlobalObject& global_object, Object& calend
if (!month_day_object)
return {};
if (!is<PlainMonthDay>(month_day_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.PlainMonthDay");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainMonthDay");
return {};
}

View file

@ -68,7 +68,7 @@ static Calendar* typed_this(GlobalObject& global_object)
if (!this_object)
return {};
if (!is<Calendar>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.Calendar");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.Calendar");
return {};
}
return static_cast<Calendar*>(this_object);

View file

@ -54,7 +54,7 @@ static Duration* typed_this(GlobalObject& global_object)
if (!this_object)
return {};
if (!is<Duration>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.Duration");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.Duration");
return {};
}
return static_cast<Duration*>(this_object);

View file

@ -59,7 +59,7 @@ static Instant* typed_this(GlobalObject& global_object)
if (!this_object)
return {};
if (!is<Instant>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.Instant");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.Instant");
return {};
}
return static_cast<Instant*>(this_object);

View file

@ -69,7 +69,7 @@ static PlainDate* typed_this(GlobalObject& global_object)
if (!this_object)
return {};
if (!is<PlainDate>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.PlainDate");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainDate");
return {};
}
return static_cast<PlainDate*>(this_object);

View file

@ -72,7 +72,7 @@ static PlainDateTime* typed_this(GlobalObject& global_object)
if (!this_object)
return {};
if (!is<PlainDateTime>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.PlainDateTime");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainDateTime");
return {};
}
return static_cast<PlainDateTime*>(this_object);

View file

@ -48,7 +48,7 @@ static PlainMonthDay* typed_this(GlobalObject& global_object)
if (!this_object)
return {};
if (!is<PlainMonthDay>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.PlainMonthDay");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainMonthDay");
return {};
}
return static_cast<PlainMonthDay*>(this_object);

View file

@ -55,7 +55,7 @@ static PlainTime* typed_this(GlobalObject& global_object)
if (!this_object)
return {};
if (!is<PlainTime>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.PlainTime");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainTime");
return {};
}
return static_cast<PlainTime*>(this_object);

View file

@ -55,7 +55,7 @@ static PlainYearMonth* typed_this(GlobalObject& global_object)
if (!this_object)
return {};
if (!is<PlainYearMonth>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.PlainYearMonth");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainYearMonth");
return {};
}
return static_cast<PlainYearMonth*>(this_object);

View file

@ -45,7 +45,7 @@ static TimeZone* typed_this(GlobalObject& global_object)
if (!this_object)
return {};
if (!is<TimeZone>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.TimeZone");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.TimeZone");
return {};
}
return static_cast<TimeZone*>(this_object);

View file

@ -80,7 +80,7 @@ static ZonedDateTime* typed_this(GlobalObject& global_object)
if (!this_object)
return {};
if (!is<ZonedDateTime>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.ZonedDateTime");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.ZonedDateTime");
return {};
}
return static_cast<ZonedDateTime*>(this_object);

View file

@ -23,7 +23,7 @@ TypedArrayBase* typed_array_from(GlobalObject& global_object, Value typed_array_
if (!this_object)
return nullptr;
if (!this_object->is_typed_array()) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "TypedArray");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "TypedArray");
return nullptr;
}
@ -36,7 +36,7 @@ void validate_typed_array(GlobalObject& global_object, TypedArrayBase& typed_arr
auto& vm = global_object.vm();
if (!typed_array.is_typed_array())
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "TypedArray");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "TypedArray");
else if (typed_array.viewed_array_buffer()->is_detached())
vm.throw_exception<TypeError>(global_object, ErrorType::DetachedArrayBuffer);
}
@ -246,7 +246,7 @@ TypedArrayBase* typed_array_create(GlobalObject& global_object, FunctionObject&
if (vm.exception())
return nullptr;
if (!new_typed_array.is_object() || !new_typed_array.as_object().is_typed_array()) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "TypedArray");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "TypedArray");
return nullptr;
}
auto& typed_array = static_cast<TypedArrayBase&>(new_typed_array.as_object());

View file

@ -40,7 +40,7 @@ WeakMap* WeakMapPrototype::typed_this(VM& vm, GlobalObject& global_object)
if (!this_object)
return {};
if (!is<WeakMap>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "WeakMap");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "WeakMap");
return nullptr;
}
return static_cast<WeakMap*>(this_object);

View file

@ -35,7 +35,7 @@ JS_DEFINE_NATIVE_FUNCTION(WeakRefPrototype::deref)
if (!this_object)
return {};
if (!is<WeakRef>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "WeakRef");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "WeakRef");
return {};
}
auto& weak_ref = static_cast<WeakRef&>(*this_object);

View file

@ -39,7 +39,7 @@ WeakSet* WeakSetPrototype::typed_this(VM& vm, GlobalObject& global_object)
if (!this_object)
return {};
if (!is<WeakSet>(this_object)) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "WeakSet");
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "WeakSet");
return nullptr;
}
return static_cast<WeakSet*>(this_object);