mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:37:34 +00:00
LibJS: Make Value::to_object() take a GlobalObject&
This commit is contained in:
parent
cd14ebb11f
commit
8d56e6103e
28 changed files with 129 additions and 129 deletions
|
@ -97,7 +97,7 @@ CallExpression::ThisAndCallee CallExpression::compute_this_and_callee(Interprete
|
|||
auto object_value = member_expression.object().execute(interpreter, global_object);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
auto* this_value = object_value.to_object(interpreter);
|
||||
auto* this_value = object_value.to_object(interpreter, global_object);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
auto callee = this_value->get(member_expression.computed_property_name(interpreter, global_object)).value_or(js_undefined());
|
||||
|
@ -365,7 +365,7 @@ Value ForInStatement::execute(Interpreter& interpreter, GlobalObject& global_obj
|
|||
auto rhs_result = m_rhs->execute(interpreter, global_object);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
auto* object = rhs_result.to_object(interpreter);
|
||||
auto* object = rhs_result.to_object(interpreter, global_object);
|
||||
while (object) {
|
||||
auto property_names = object->get_own_properties(*object, Object::GetOwnPropertyMode::Key, true);
|
||||
for (auto& property_name : property_names.as_object().indexed_properties()) {
|
||||
|
@ -587,7 +587,7 @@ Value UnaryExpression::execute(Interpreter& interpreter, GlobalObject& global_ob
|
|||
ASSERT(!reference.is_local_variable());
|
||||
if (reference.is_global_variable())
|
||||
return global_object.delete_property(reference.name());
|
||||
auto* base_object = reference.base().to_object(interpreter);
|
||||
auto* base_object = reference.base().to_object(interpreter, global_object);
|
||||
if (!base_object)
|
||||
return {};
|
||||
return base_object->delete_property(reference.name());
|
||||
|
@ -1435,7 +1435,7 @@ Value MemberExpression::execute(Interpreter& interpreter, GlobalObject& global_o
|
|||
auto object_value = m_object->execute(interpreter, global_object);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
auto* object_result = object_value.to_object(interpreter);
|
||||
auto* object_result = object_value.to_object(interpreter, global_object);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
return object_result->get(computed_property_name(interpreter, global_object)).value_or(js_undefined());
|
||||
|
|
|
@ -51,7 +51,7 @@ Array::~Array()
|
|||
|
||||
Array* Array::typed_this(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
if (!this_object->is_array()) {
|
||||
|
|
|
@ -105,7 +105,7 @@ static size_t get_length(Interpreter& interpreter, Object& object)
|
|||
|
||||
static void for_each_item(Interpreter& interpreter, GlobalObject& global_object, const String& name, AK::Function<IterationDecision(size_t index, Value value, Value callback_result)> callback, bool skip_empty = true)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return;
|
||||
|
||||
|
@ -164,7 +164,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::for_each)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::map)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
auto initial_length = get_length(interpreter, *this_object);
|
||||
|
@ -183,7 +183,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::map)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::push)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
if (this_object->is_array()) {
|
||||
|
@ -223,7 +223,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::unshift)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::pop)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
if (this_object->is_array()) {
|
||||
|
@ -265,7 +265,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::shift)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_string)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
auto join_function = this_object->get("join");
|
||||
|
@ -278,7 +278,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_string)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_locale_string)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
String separator = ","; // NOTE: This is implementation-specific.
|
||||
|
@ -294,7 +294,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_locale_string)
|
|||
return {};
|
||||
if (value.is_undefined() || value.is_null())
|
||||
continue;
|
||||
auto* value_object = value.to_object(interpreter);
|
||||
auto* value_object = value.to_object(interpreter, global_object);
|
||||
ASSERT(value_object);
|
||||
auto locale_string_result = value_object->invoke("toLocaleString");
|
||||
if (interpreter.exception())
|
||||
|
@ -309,7 +309,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_locale_string)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::join)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
String separator = ",";
|
||||
|
@ -411,7 +411,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::slice)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::index_of)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
i32 length = get_length(interpreter, *this_object);
|
||||
|
@ -442,7 +442,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::index_of)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
|
||||
|
@ -501,7 +501,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce_right)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
|
||||
|
@ -584,7 +584,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reverse)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::last_index_of)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
i32 length = get_length(interpreter, *this_object);
|
||||
|
@ -615,7 +615,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::last_index_of)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::includes)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
i32 length = get_length(interpreter, *this_object);
|
||||
|
@ -702,7 +702,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::every)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::splice)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
|
||||
|
@ -805,7 +805,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::splice)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::fill)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ BigIntPrototype::~BigIntPrototype()
|
|||
|
||||
static BigIntObject* bigint_object_from(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return nullptr;
|
||||
if (!this_object->is_bigint_object()) {
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace JS {
|
|||
|
||||
static Date* typed_this(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return nullptr;
|
||||
if (!this_object->is_date()) {
|
||||
|
|
|
@ -54,7 +54,7 @@ ErrorPrototype::~ErrorPrototype()
|
|||
|
||||
JS_DEFINE_NATIVE_GETTER(ErrorPrototype::name_getter)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
if (!this_object->is_error())
|
||||
|
@ -64,7 +64,7 @@ JS_DEFINE_NATIVE_GETTER(ErrorPrototype::name_getter)
|
|||
|
||||
JS_DEFINE_NATIVE_SETTER(ErrorPrototype::name_setter)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return;
|
||||
if (!this_object->is_error()) {
|
||||
|
@ -79,7 +79,7 @@ JS_DEFINE_NATIVE_SETTER(ErrorPrototype::name_setter)
|
|||
|
||||
JS_DEFINE_NATIVE_GETTER(ErrorPrototype::message_getter)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
if (!this_object->is_error())
|
||||
|
|
|
@ -61,7 +61,7 @@ BoundFunction* Function::bind(Value bound_this_value, Vector<Value> arguments)
|
|||
return bound_this_value;
|
||||
return &global_object();
|
||||
default:
|
||||
return bound_this_value.to_object(interpreter());
|
||||
return bound_this_value.to_object(interpreter(), global_object());
|
||||
}
|
||||
}();
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ FunctionPrototype::~FunctionPrototype()
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::apply)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
if (!this_object->is_function())
|
||||
|
@ -90,7 +90,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::apply)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::bind)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
if (!this_object->is_function())
|
||||
|
@ -110,7 +110,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::bind)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::call)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
if (!this_object->is_function())
|
||||
|
@ -127,7 +127,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::call)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::to_string)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
if (!this_object->is_function())
|
||||
|
|
|
@ -77,7 +77,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_names)
|
|||
{
|
||||
if (!interpreter.argument_count())
|
||||
return {};
|
||||
auto* object = interpreter.argument(0).to_object(interpreter);
|
||||
auto* object = interpreter.argument(0).to_object(interpreter, global_object);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
auto* result = Array::create(global_object);
|
||||
|
@ -93,7 +93,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_prototype_of)
|
|||
{
|
||||
if (!interpreter.argument_count())
|
||||
return {};
|
||||
auto* object = interpreter.argument(0).to_object(interpreter);
|
||||
auto* object = interpreter.argument(0).to_object(interpreter, global_object);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
return object->prototype();
|
||||
|
@ -103,7 +103,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::set_prototype_of)
|
|||
{
|
||||
if (interpreter.argument_count() < 2)
|
||||
return interpreter.throw_exception<TypeError>(ErrorType::ObjectSetPrototypeOfTwoArgs);
|
||||
auto* object = interpreter.argument(0).to_object(interpreter);
|
||||
auto* object = interpreter.argument(0).to_object(interpreter, global_object);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
auto prototype_value = interpreter.argument(1);
|
||||
|
@ -147,7 +147,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::prevent_extensions)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_descriptor)
|
||||
{
|
||||
auto* object = interpreter.argument(0).to_object(interpreter);
|
||||
auto* object = interpreter.argument(0).to_object(interpreter, global_object);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
auto property_key = interpreter.argument(1).to_string(interpreter);
|
||||
|
@ -190,7 +190,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::keys)
|
|||
if (!interpreter.argument_count())
|
||||
return interpreter.throw_exception<TypeError>(ErrorType::ConvertUndefinedToObject);
|
||||
|
||||
auto* obj_arg = interpreter.argument(0).to_object(interpreter);
|
||||
auto* obj_arg = interpreter.argument(0).to_object(interpreter, global_object);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
|
||||
|
@ -202,7 +202,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::values)
|
|||
if (!interpreter.argument_count())
|
||||
return interpreter.throw_exception<TypeError>(ErrorType::ConvertUndefinedToObject);
|
||||
|
||||
auto* obj_arg = interpreter.argument(0).to_object(interpreter);
|
||||
auto* obj_arg = interpreter.argument(0).to_object(interpreter, global_object);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
|
||||
|
@ -214,7 +214,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::entries)
|
|||
if (!interpreter.argument_count())
|
||||
return interpreter.throw_exception<TypeError>(ErrorType::ConvertUndefinedToObject);
|
||||
|
||||
auto* obj_arg = interpreter.argument(0).to_object(interpreter);
|
||||
auto* obj_arg = interpreter.argument(0).to_object(interpreter, global_object);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ ObjectPrototype::~ObjectPrototype()
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::has_own_property)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
auto name = interpreter.argument(0).to_string(interpreter);
|
||||
|
@ -67,7 +67,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::has_own_property)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_string)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
return js_string(interpreter, String::format("[object %s]", this_object->class_name()));
|
||||
|
@ -75,7 +75,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_string)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_locale_string)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
return this_object->invoke("toString");
|
||||
|
@ -83,7 +83,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_locale_string)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::value_of)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
return this_object->value_of();
|
||||
|
|
|
@ -55,7 +55,7 @@ void Reference::put(Interpreter& interpreter, Value value)
|
|||
return;
|
||||
}
|
||||
|
||||
auto* object = base().to_object(interpreter);
|
||||
auto* object = base().to_object(interpreter, interpreter.global_object());
|
||||
if (!object)
|
||||
return;
|
||||
|
||||
|
@ -97,7 +97,7 @@ Value Reference::get(Interpreter& interpreter)
|
|||
return value;
|
||||
}
|
||||
|
||||
auto* object = base().to_object(interpreter);
|
||||
auto* object = base().to_object(interpreter, interpreter.global_object());
|
||||
if (!object)
|
||||
return {};
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace JS {
|
|||
|
||||
static ScriptFunction* typed_this(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return nullptr;
|
||||
if (!this_object->is_function()) {
|
||||
|
|
|
@ -78,7 +78,7 @@ Value StringConstructor::construct(Interpreter& interpreter)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(StringConstructor::raw)
|
||||
{
|
||||
auto* template_object = interpreter.argument(0).to_object(interpreter);
|
||||
auto* template_object = interpreter.argument(0).to_object(interpreter, global_object);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
|
||||
|
@ -92,7 +92,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::raw)
|
|||
if (!raw.is_array())
|
||||
return js_string(interpreter, "");
|
||||
|
||||
auto* array = static_cast<Array*>(raw.to_object(interpreter));
|
||||
auto* array = static_cast<Array*>(raw.to_object(interpreter, global_object));
|
||||
auto& raw_array_elements = array->indexed_properties();
|
||||
StringBuilder builder;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace JS {
|
|||
|
||||
static StringObject* typed_this(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return nullptr;
|
||||
if (!this_object->is_string_object()) {
|
||||
|
@ -53,7 +53,7 @@ static StringObject* typed_this(Interpreter& interpreter, GlobalObject& global_o
|
|||
|
||||
static String ak_string_from(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
return Value(this_object).to_string(interpreter);
|
||||
|
|
|
@ -58,7 +58,7 @@ SymbolPrototype::~SymbolPrototype()
|
|||
|
||||
static SymbolObject* typed_this(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return nullptr;
|
||||
if (!this_object->is_symbol_object()) {
|
||||
|
|
|
@ -55,7 +55,7 @@ Uint8ClampedArray::~Uint8ClampedArray()
|
|||
|
||||
JS_DEFINE_NATIVE_GETTER(Uint8ClampedArray::length_getter)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter, global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
if (StringView(this_object->class_name()) != "Uint8ClampedArray")
|
||||
|
|
|
@ -207,7 +207,7 @@ Value Value::to_primitive(Interpreter&, PreferredType preferred_type) const
|
|||
return *this;
|
||||
}
|
||||
|
||||
Object* Value::to_object(Interpreter& interpreter) const
|
||||
Object* Value::to_object(Interpreter& interpreter, GlobalObject& global_object) const
|
||||
{
|
||||
switch (m_type) {
|
||||
case Type::Undefined:
|
||||
|
@ -215,15 +215,15 @@ Object* Value::to_object(Interpreter& interpreter) const
|
|||
interpreter.throw_exception<TypeError>(ErrorType::ToObjectNullOrUndef);
|
||||
return nullptr;
|
||||
case Type::Boolean:
|
||||
return BooleanObject::create(interpreter.global_object(), m_value.as_bool);
|
||||
return BooleanObject::create(global_object, m_value.as_bool);
|
||||
case Type::Number:
|
||||
return NumberObject::create(interpreter.global_object(), m_value.as_double);
|
||||
return NumberObject::create(global_object, m_value.as_double);
|
||||
case Type::String:
|
||||
return StringObject::create(interpreter.global_object(), *m_value.as_string);
|
||||
return StringObject::create(global_object, *m_value.as_string);
|
||||
case Type::Symbol:
|
||||
return SymbolObject::create(interpreter.global_object(), *m_value.as_symbol);
|
||||
return SymbolObject::create(global_object, *m_value.as_symbol);
|
||||
case Type::BigInt:
|
||||
return BigIntObject::create(interpreter.global_object(), *m_value.as_bigint);
|
||||
return BigIntObject::create(global_object, *m_value.as_bigint);
|
||||
case Type::Object:
|
||||
return &const_cast<Object&>(as_object());
|
||||
default:
|
||||
|
|
|
@ -229,7 +229,7 @@ public:
|
|||
String to_string(Interpreter&) const;
|
||||
PrimitiveString* to_primitive_string(Interpreter&);
|
||||
Value to_primitive(Interpreter&, PreferredType preferred_type = PreferredType::Default) const;
|
||||
Object* to_object(Interpreter&) const;
|
||||
Object* to_object(Interpreter&, GlobalObject&) const;
|
||||
Value to_numeric(Interpreter&) const;
|
||||
Value to_number(Interpreter&) const;
|
||||
BigInt* to_bigint(Interpreter&) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue