mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 15:43:20 +00:00
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:
parent
979761ad82
commit
cb56ea7e24
Notes:
github-actions[bot]
2025-10-03 07:05:07 +00:00
Author: https://github.com/trflynn89
Commit: cb56ea7e24
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6372
Reviewed-by: https://github.com/gmta ✅
3 changed files with 5 additions and 13 deletions
|
@ -123,13 +123,15 @@ ThrowCompletionOr<GC::Ref<Object>> ErrorConstructor::construct(FunctionObject& n
|
|||
JS_ENUMERATE_NATIVE_ERRORS
|
||||
#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)
|
||||
{
|
||||
auto arg = vm.argument(0);
|
||||
|
||||
// 1. Return IsError(arg).
|
||||
return Value(arg.is_error());
|
||||
// 1. If arg is not an Object, return false.
|
||||
// 2. If arg does not have an [[ErrorData]] internal slot, return false.
|
||||
// 3. Return true.
|
||||
return arg.is_object() && is<Error>(arg.as_object());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -260,15 +260,6 @@ Array& Value::as_array()
|
|||
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
|
||||
bool Value::is_function() const
|
||||
{
|
||||
|
|
|
@ -110,7 +110,6 @@ public:
|
|||
ThrowCompletionOr<bool> is_array(VM&) const;
|
||||
bool is_function() const;
|
||||
bool is_constructor() const;
|
||||
bool is_error() const;
|
||||
ThrowCompletionOr<bool> is_regexp(VM&) const;
|
||||
|
||||
bool is_infinity() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue