mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +00:00
LibJS: Allow implicit Value construction from GC-allocated things
This commit is contained in:
parent
7912f33ea0
commit
32963cf74a
4 changed files with 10 additions and 10 deletions
|
@ -81,10 +81,10 @@ bool Value::to_boolean() const
|
|||
Value Value::to_object(Heap& heap) const
|
||||
{
|
||||
if (is_object())
|
||||
return Value(as_object());
|
||||
return const_cast<Object*>(as_object());
|
||||
|
||||
if (is_string())
|
||||
return Value(heap.allocate<StringObject>(m_value.as_string));
|
||||
return heap.allocate<StringObject>(m_value.as_string);
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue