mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:07:45 +00:00
LibJS: Make Handle<Value>::is_null() also consider the contained value
Previously this would've said `make_handle(Value(1234))` is null, as it did not contain a cell (but rather a plain Value), which made throwing primitives spin forever in BC mode.
This commit is contained in:
parent
431776ebb7
commit
5407fe8fcf
1 changed files with 3 additions and 3 deletions
|
@ -95,8 +95,8 @@ public:
|
||||||
|
|
||||||
auto cell() { return m_handle.cell(); }
|
auto cell() { return m_handle.cell(); }
|
||||||
auto cell() const { return m_handle.cell(); }
|
auto cell() const { return m_handle.cell(); }
|
||||||
auto value() const { return m_value; }
|
auto value() const { return *m_value; }
|
||||||
bool is_null() const { return m_handle.is_null(); }
|
bool is_null() const { return m_handle.is_null() && !m_value.has_value(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit Handle(Value value)
|
explicit Handle(Value value)
|
||||||
|
@ -110,7 +110,7 @@ private:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Value m_value;
|
Optional<Value> m_value;
|
||||||
Handle<Cell> m_handle;
|
Handle<Cell> m_handle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue