LibJS: Don't require Interpreter& in PropertyName and StringOrSymbol

This commit is contained in:
Andreas Kling 2020-09-27 19:55:21 +02:00
parent 1df18c58f5
commit b9793e603c
Notes: sideshowbarker 2024-07-19 02:10:21 +09:00
5 changed files with 8 additions and 8 deletions

View file

@ -1285,7 +1285,7 @@ Value AssignmentExpression::execute(Interpreter& interpreter, GlobalObject& glob
interpreter.vm().throw_exception<ReferenceError>(global_object, ErrorType::InvalidLeftHandAssignment);
return {};
}
update_function_name(rhs_result, get_function_name(global_object, reference.name().to_value(interpreter)));
update_function_name(rhs_result, get_function_name(global_object, reference.name().to_value(interpreter.vm())));
reference.put(interpreter, global_object, rhs_result);
if (interpreter.exception())

View file

@ -237,12 +237,12 @@ Value Object::get_own_properties(const Object& this_object, PropertyKind kind, b
continue;
if (kind == PropertyKind::Key) {
properties_array->define_property(property_index, it.key.to_value(interpreter()));
properties_array->define_property(property_index, it.key.to_value(vm()));
} else if (kind == PropertyKind::Value) {
properties_array->define_property(property_index, this_object.get(it.key));
} else {
auto* entry_array = Array::create(global_object());
entry_array->define_property(0, it.key.to_value(interpreter()));
entry_array->define_property(0, it.key.to_value(vm()));
entry_array->define_property(1, this_object.get(it.key));
properties_array->define_property(property_index, entry_array);
}

View file

@ -136,10 +136,10 @@ public:
return StringOrSymbol(as_symbol());
}
Value to_value(Interpreter& interpreter) const
Value to_value(VM& vm) const
{
if (is_string())
return js_string(interpreter, m_string);
return js_string(vm, m_string);
if (is_number())
return Value(m_number);
if (is_symbol())

View file

@ -279,7 +279,7 @@ bool ProxyObject::define_property(const StringOrSymbol& property_name, const Obj
return false;
}
auto trap_result = vm().call(trap.as_function(), Value(&m_handler), Value(&m_target), property_name.to_value(interpreter()), Value(const_cast<Object*>(&descriptor))).to_boolean();
auto trap_result = vm().call(trap.as_function(), Value(&m_handler), Value(&m_target), property_name.to_value(vm()), Value(const_cast<Object*>(&descriptor))).to_boolean();
if (vm().exception() || !trap_result)
return false;
auto target_desc = m_target.get_own_property_descriptor(property_name);

View file

@ -99,10 +99,10 @@ public:
ASSERT_NOT_REACHED();
}
Value to_value(Interpreter& interpreter) const
Value to_value(VM& vm) const
{
if (is_string())
return js_string(interpreter, as_string());
return js_string(vm, as_string());
if (is_symbol())
return const_cast<Symbol*>(as_symbol());
return {};