From 3a7da923e655d338f945680b7190113271039d19 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 14 Jun 2024 09:37:26 +0200 Subject: [PATCH] LibJS/Bytecode: Rename TypeofVariable => TypeofBinding (cherry picked from commit 4302e073463c403f8d7ab09c42e7644089fc33a2) --- Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp | 2 +- .../Libraries/LibJS/Bytecode/CommonImplementations.h | 2 +- Userland/Libraries/LibJS/Bytecode/Instruction.h | 2 +- Userland/Libraries/LibJS/Bytecode/Interpreter.cpp | 10 +++++----- Userland/Libraries/LibJS/Bytecode/Op.h | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp index 455dcc17f4..5be01c2fc1 100644 --- a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp +++ b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp @@ -362,7 +362,7 @@ Bytecode::CodeGenerationErrorOr> UnaryExpression::genera if (is(*m_lhs)) { auto& identifier = static_cast(*m_lhs); if (!identifier.is_local()) { - generator.emit(dst, generator.intern_identifier(identifier.string())); + generator.emit(dst, generator.intern_identifier(identifier.string())); break; } } diff --git a/Userland/Libraries/LibJS/Bytecode/CommonImplementations.h b/Userland/Libraries/LibJS/Bytecode/CommonImplementations.h index 2a76efa7a0..41a1da612b 100644 --- a/Userland/Libraries/LibJS/Bytecode/CommonImplementations.h +++ b/Userland/Libraries/LibJS/Bytecode/CommonImplementations.h @@ -389,7 +389,7 @@ inline ThrowCompletionOr throw_if_needed_for_call(Interpreter& interpreter return {}; } -inline ThrowCompletionOr typeof_variable(VM& vm, DeprecatedFlyString const& string) +inline ThrowCompletionOr typeof_binding(VM& vm, DeprecatedFlyString const& string) { // 1. Let val be the result of evaluating UnaryExpression. auto reference = TRY(vm.resolve_binding(string)); diff --git a/Userland/Libraries/LibJS/Bytecode/Instruction.h b/Userland/Libraries/LibJS/Bytecode/Instruction.h index 39f56abfbc..7099c7868d 100644 --- a/Userland/Libraries/LibJS/Bytecode/Instruction.h +++ b/Userland/Libraries/LibJS/Bytecode/Instruction.h @@ -138,7 +138,7 @@ O(ThrowIfNullish) \ O(ThrowIfTDZ) \ O(Typeof) \ - O(TypeofVariable) \ + O(TypeofBinding) \ O(UnaryMinus) \ O(UnaryPlus) \ O(UnsignedRightShift) \ diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index 16a1eb3131..f2aa7e662b 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -663,7 +663,7 @@ FLATTEN_ON_CLANG void Interpreter::run_bytecode(size_t entry_point) HANDLE_INSTRUCTION(ThrowIfNullish); HANDLE_INSTRUCTION(ThrowIfTDZ); HANDLE_INSTRUCTION(Typeof); - HANDLE_INSTRUCTION(TypeofVariable); + HANDLE_INSTRUCTION(TypeofBinding); HANDLE_INSTRUCTION(UnaryMinus); HANDLE_INSTRUCTION(UnaryPlus); HANDLE_INSTRUCTION(UnsignedRightShift); @@ -1979,10 +1979,10 @@ ThrowCompletionOr NewClass::execute_impl(Bytecode::Interpreter& interprete } // 13.5.3.1 Runtime Semantics: Evaluation, https://tc39.es/ecma262/#sec-typeof-operator-runtime-semantics-evaluation -ThrowCompletionOr TypeofVariable::execute_impl(Bytecode::Interpreter& interpreter) const +ThrowCompletionOr TypeofBinding::execute_impl(Bytecode::Interpreter& interpreter) const { auto& vm = interpreter.vm(); - interpreter.set(dst(), TRY(typeof_variable(vm, interpreter.current_executable().get_identifier(m_identifier)))); + interpreter.set(dst(), TRY(typeof_binding(vm, interpreter.current_executable().get_identifier(m_identifier)))); return {}; } @@ -2685,9 +2685,9 @@ ByteString GetImportMeta::to_byte_string_impl(Bytecode::Executable const& execut return ByteString::formatted("GetImportMeta {}", format_operand("dst"sv, m_dst, executable)); } -ByteString TypeofVariable::to_byte_string_impl(Bytecode::Executable const& executable) const +ByteString TypeofBinding::to_byte_string_impl(Bytecode::Executable const& executable) const { - return ByteString::formatted("TypeofVariable {}, {}", + return ByteString::formatted("TypeofBinding {}, {}", format_operand("dst"sv, m_dst, executable), executable.identifier_table->get(m_identifier)); } diff --git a/Userland/Libraries/LibJS/Bytecode/Op.h b/Userland/Libraries/LibJS/Bytecode/Op.h index 8a674785e1..f50ef25ffa 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.h +++ b/Userland/Libraries/LibJS/Bytecode/Op.h @@ -2623,10 +2623,10 @@ private: Operand m_dst; }; -class TypeofVariable final : public Instruction { +class TypeofBinding final : public Instruction { public: - TypeofVariable(Operand dst, IdentifierTableIndex identifier) - : Instruction(Type::TypeofVariable) + TypeofBinding(Operand dst, IdentifierTableIndex identifier) + : Instruction(Type::TypeofBinding) , m_dst(dst) , m_identifier(identifier) {