mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:17:44 +00:00
LibJS: Add Value(GCPtr<T>) and Value(NonnullGCPtr<T>) constructors
Let's avoid reaching for ptr() as much as possible.
This commit is contained in:
parent
c2326ec95a
commit
d3b7c06712
1 changed files with 13 additions and 0 deletions
|
@ -18,6 +18,7 @@
|
|||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Heap/GCPtr.h>
|
||||
#include <LibJS/Runtime/BigInt.h>
|
||||
#include <LibJS/Runtime/Utf16String.h>
|
||||
#include <math.h>
|
||||
|
@ -275,6 +276,18 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Value(GCPtr<T> ptr)
|
||||
: Value(ptr.ptr())
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Value(NonnullGCPtr<T> ptr)
|
||||
: Value(ptr.ptr())
|
||||
{
|
||||
}
|
||||
|
||||
double as_double() const
|
||||
{
|
||||
VERIFY(is_number());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue