summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Runtime/Value.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-05-17 21:38:47 +0100
committerAndreas Kling <kling@serenityos.org>2020-05-18 09:39:55 +0200
commit1a1394f7a2f17bb0631cc4aaaa9c78f0cf700312 (patch)
tree0bdc66af107764ec738edfebd115f40cd580937e /Libraries/LibJS/Runtime/Value.cpp
parentb8b7f84547a1854a265cd94fe8037b039eb428e7 (diff)
downloadserenity-1a1394f7a2f17bb0631cc4aaaa9c78f0cf700312.zip
LibJS: Change Value::to_object(Heap& -> Interpreter&)
Passing a Heap& to it only to then call interpreter() on that is weird. Let's just give it the Interpreter& directly, like some of the other to_something() functions.
Diffstat (limited to 'Libraries/LibJS/Runtime/Value.cpp')
-rw-r--r--Libraries/LibJS/Runtime/Value.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Libraries/LibJS/Runtime/Value.cpp b/Libraries/LibJS/Runtime/Value.cpp
index 8055331c02..46c19bc49b 100644
--- a/Libraries/LibJS/Runtime/Value.cpp
+++ b/Libraries/LibJS/Runtime/Value.cpp
@@ -176,25 +176,25 @@ Value Value::to_primitive(Interpreter&) const
return *this;
}
-Object* Value::to_object(Heap& heap) const
+Object* Value::to_object(Interpreter& interpreter) const
{
if (is_object())
return &const_cast<Object&>(as_object());
if (is_string())
- return StringObject::create(heap.interpreter().global_object(), *m_value.as_string);
+ return StringObject::create(interpreter.global_object(), *m_value.as_string);
if (is_symbol())
- return SymbolObject::create(heap.interpreter().global_object(), *m_value.as_symbol);
+ return SymbolObject::create(interpreter.global_object(), *m_value.as_symbol);
if (is_number())
- return NumberObject::create(heap.interpreter().global_object(), m_value.as_double);
+ return NumberObject::create(interpreter.global_object(), m_value.as_double);
if (is_boolean())
- return BooleanObject::create(heap.interpreter().global_object(), m_value.as_bool);
+ return BooleanObject::create(interpreter.global_object(), m_value.as_bool);
if (is_null() || is_undefined()) {
- heap.interpreter().throw_exception<TypeError>("ToObject on null or undefined.");
+ interpreter.throw_exception<TypeError>("ToObject on null or undefined.");
return nullptr;
}