LibJS: Rename Value::typeof() to Value::typeof_()

This to avoid clashing with the GCC typeof extension, which apparently
confuses clang-format.
This commit is contained in:
Andreas Kling 2024-07-23 10:25:06 +02:00 committed by Andreas Kling
parent d0b11af387
commit 14beda00c9
Notes: github-actions[bot] 2024-07-23 09:48:28 +00:00
3 changed files with 6 additions and 6 deletions

View file

@ -1193,7 +1193,7 @@ inline ThrowCompletionOr<void> put_by_property_key(VM& vm, Value base, Value thi
if (!succeeded && vm.in_strict_mode()) {
if (base.is_object())
return vm.throw_completion<TypeError>(ErrorType::ReferenceNullishSetProperty, name, base.to_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::ReferencePrimitiveSetProperty, name, base.typeof(vm)->utf8_string(), base.to_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::ReferencePrimitiveSetProperty, name, base.typeof_(vm)->utf8_string(), base.to_string_without_side_effects());
}
break;
}
@ -2018,7 +2018,7 @@ static ThrowCompletionOr<Value> not_(VM&, Value value)
static ThrowCompletionOr<Value> typeof_(VM& vm, Value value)
{
return value.typeof(vm);
return value.typeof_(vm);
}
#define JS_DEFINE_COMMON_UNARY_OP(OpTitleCase, op_snake_case) \
@ -2873,7 +2873,7 @@ ThrowCompletionOr<void> TypeofBinding::execute_impl(Bytecode::Interpreter& inter
environment = environment->outer_environment();
if (!environment->is_permanently_screwed_by_eval()) {
auto value = TRY(static_cast<DeclarativeEnvironment const&>(*environment).get_binding_value_direct(vm, m_cache.index));
interpreter.set(dst(), value.typeof(vm));
interpreter.set(dst(), value.typeof_(vm));
return {};
}
m_cache = {};
@ -2897,7 +2897,7 @@ ThrowCompletionOr<void> TypeofBinding::execute_impl(Bytecode::Interpreter& inter
// 4. NOTE: This step is replaced in section B.3.6.3.
// 5. Return a String according to Table 41.
interpreter.set(dst(), value.typeof(vm));
interpreter.set(dst(), value.typeof_(vm));
return {};
}

View file

@ -313,7 +313,7 @@ ThrowCompletionOr<bool> Value::is_regexp(VM& vm) const
}
// 13.5.3 The typeof Operator, https://tc39.es/ecma262/#sec-typeof-operator
NonnullGCPtr<PrimitiveString> Value::typeof(VM& vm) const
NonnullGCPtr<PrimitiveString> Value::typeof_(VM& vm) const
{
// 9. If val is a Number, return "number".
if (is_number())

View file

@ -418,7 +418,7 @@ public:
return *this;
}
[[nodiscard]] NonnullGCPtr<PrimitiveString> typeof(VM&) const;
[[nodiscard]] NonnullGCPtr<PrimitiveString> typeof_(VM&) const;
bool operator==(Value const&) const;