LibJS: Update spec links and steps for the Error.isError proposal

This proposal reached stage 4 and was merged into ECMA-262. See:
caa0482
This commit is contained in:
Timothy Flynn 2025-10-01 11:58:16 -04:00 committed by Jelle Raaijmakers
parent 979761ad82
commit cb56ea7e24
Notes: github-actions[bot] 2025-10-03 07:05:07 +00:00
3 changed files with 5 additions and 13 deletions

View file

@ -123,13 +123,15 @@ ThrowCompletionOr<GC::Ref<Object>> ErrorConstructor::construct(FunctionObject& n
JS_ENUMERATE_NATIVE_ERRORS JS_ENUMERATE_NATIVE_ERRORS
#undef __JS_ENUMERATE #undef __JS_ENUMERATE
// 20.5.2.1 Error.isError ( arg ), https://tc39.es/proposal-is-error/#sec-error.iserror // 20.5.2.1 Error.isError ( arg ), https://tc39.es/ecma262/#sec-error.iserror
JS_DEFINE_NATIVE_FUNCTION(ErrorConstructor::is_error) JS_DEFINE_NATIVE_FUNCTION(ErrorConstructor::is_error)
{ {
auto arg = vm.argument(0); auto arg = vm.argument(0);
// 1. Return IsError(arg). // 1. If arg is not an Object, return false.
return Value(arg.is_error()); // 2. If arg does not have an [[ErrorData]] internal slot, return false.
// 3. Return true.
return arg.is_object() && is<Error>(arg.as_object());
} }
} }

View file

@ -260,15 +260,6 @@ Array& Value::as_array()
return static_cast<Array&>(as_object()); return static_cast<Array&>(as_object());
} }
// 20.5.8.2 IsError ( argument ), https://tc39.es/proposal-is-error/#sec-iserror
bool Value::is_error() const
{
// 1. If argument is not an Object, return false.
// 2. If argument has an [[ErrorData]] internal slot, return true.
// 3. Return false.
return is_object() && is<Error>(as_object());
}
// 7.2.3 IsCallable ( argument ), https://tc39.es/ecma262/#sec-iscallable // 7.2.3 IsCallable ( argument ), https://tc39.es/ecma262/#sec-iscallable
bool Value::is_function() const bool Value::is_function() const
{ {

View file

@ -110,7 +110,6 @@ public:
ThrowCompletionOr<bool> is_array(VM&) const; ThrowCompletionOr<bool> is_array(VM&) const;
bool is_function() const; bool is_function() const;
bool is_constructor() const; bool is_constructor() const;
bool is_error() const;
ThrowCompletionOr<bool> is_regexp(VM&) const; ThrowCompletionOr<bool> is_regexp(VM&) const;
bool is_infinity() const bool is_infinity() const