mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
LibJS: Flesh out JS::Value a little bit more
This commit is contained in:
parent
d52130836e
commit
1611071ac7
Notes:
sideshowbarker
2024-07-19 08:51:05 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/1611071ac73
1 changed files with 12 additions and 0 deletions
|
@ -51,6 +51,12 @@ public:
|
|||
bool is_object() const { return m_type == Type::Object; }
|
||||
bool is_boolean() const { return m_type == Type::Boolean; }
|
||||
|
||||
explicit Value(bool value)
|
||||
: m_type(Type::Boolean)
|
||||
{
|
||||
m_value.as_bool = value;
|
||||
}
|
||||
|
||||
explicit Value(double value)
|
||||
: m_type(Type::Number)
|
||||
{
|
||||
|
@ -100,6 +106,12 @@ public:
|
|||
return m_value.as_object;
|
||||
}
|
||||
|
||||
const StringImpl* as_string() const
|
||||
{
|
||||
ASSERT(is_string());
|
||||
return m_value.as_string;
|
||||
}
|
||||
|
||||
String to_string() const;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Reference in a new issue