From 14beda00c9e823dd34da74e7d8fdf46aa57e845c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 23 Jul 2024 10:25:06 +0200 Subject: [PATCH] LibJS: Rename Value::typeof() to Value::typeof_() This to avoid clashing with the GCC typeof extension, which apparently confuses clang-format. --- Userland/Libraries/LibJS/Bytecode/Interpreter.cpp | 8 ++++---- Userland/Libraries/LibJS/Runtime/Value.cpp | 2 +- Userland/Libraries/LibJS/Runtime/Value.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index c2e7d38b9ce..889f15ed6b8 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -1193,7 +1193,7 @@ inline ThrowCompletionOr put_by_property_key(VM& vm, Value base, Value thi if (!succeeded && vm.in_strict_mode()) { if (base.is_object()) return vm.throw_completion(ErrorType::ReferenceNullishSetProperty, name, base.to_string_without_side_effects()); - return vm.throw_completion(ErrorType::ReferencePrimitiveSetProperty, name, base.typeof(vm)->utf8_string(), base.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::ReferencePrimitiveSetProperty, name, base.typeof_(vm)->utf8_string(), base.to_string_without_side_effects()); } break; } @@ -2018,7 +2018,7 @@ static ThrowCompletionOr not_(VM&, Value value) static ThrowCompletionOr 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 TypeofBinding::execute_impl(Bytecode::Interpreter& inter environment = environment->outer_environment(); if (!environment->is_permanently_screwed_by_eval()) { auto value = TRY(static_cast(*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 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 {}; } diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index 8d9abc729ef..70a9c33df11 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -313,7 +313,7 @@ ThrowCompletionOr Value::is_regexp(VM& vm) const } // 13.5.3 The typeof Operator, https://tc39.es/ecma262/#sec-typeof-operator -NonnullGCPtr Value::typeof(VM& vm) const +NonnullGCPtr Value::typeof_(VM& vm) const { // 9. If val is a Number, return "number". if (is_number()) diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h index 6609a4e0bb0..dda33b783bc 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.h +++ b/Userland/Libraries/LibJS/Runtime/Value.h @@ -418,7 +418,7 @@ public: return *this; } - [[nodiscard]] NonnullGCPtr typeof(VM&) const; + [[nodiscard]] NonnullGCPtr typeof_(VM&) const; bool operator==(Value const&) const;