1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

LibJS: Add Value::{is, as}_function()

This commit is contained in:
Linus Groh 2020-05-06 11:52:53 +01:00 committed by Andreas Kling
parent 419bce6915
commit eea62dd365
6 changed files with 26 additions and 15 deletions

View file

@ -54,6 +54,7 @@ public:
bool is_boolean() const { return m_type == Type::Boolean; }
bool is_cell() const { return is_string() || is_object(); }
bool is_array() const;
bool is_function() const;
bool is_nan() const { return is_number() && __builtin_isnan(as_double()); }
bool is_infinity() const { return is_number() && __builtin_isinf(as_double()); }
@ -157,6 +158,8 @@ public:
return m_value.as_cell;
}
Function& as_function();
String to_string() const;
bool to_boolean() const;
Value to_number() const;