diff options
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibJS/Runtime/Value.cpp | 6 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/Value.h | 9 |
2 files changed, 7 insertions, 8 deletions
diff --git a/Libraries/LibJS/Runtime/Value.cpp b/Libraries/LibJS/Runtime/Value.cpp index 0df5149a6f..a1d3b0ece0 100644 --- a/Libraries/LibJS/Runtime/Value.cpp +++ b/Libraries/LibJS/Runtime/Value.cpp @@ -62,12 +62,6 @@ Function& Value::as_function() return static_cast<Function&>(as_object()); } -Accessor& Value::as_accessor() -{ - ASSERT(is_accessor()); - return static_cast<Accessor&>(*m_value.as_accessor); -} - String Value::to_string_without_side_effects() const { switch (m_type) { diff --git a/Libraries/LibJS/Runtime/Value.h b/Libraries/LibJS/Runtime/Value.h index cb3e1c5835..0b252e2c6f 100644 --- a/Libraries/LibJS/Runtime/Value.h +++ b/Libraries/LibJS/Runtime/Value.h @@ -201,10 +201,13 @@ public: return m_value.as_cell; } - String to_string_without_side_effects() const; + Accessor& as_accessor() + { + ASSERT(is_accessor()); + return *m_value.as_accessor; + } Function& as_function(); - Accessor& as_accessor(); i32 as_i32() const; size_t as_size_t() const; @@ -219,6 +222,8 @@ public: size_t to_size_t(Interpreter&) const; bool to_boolean() const; + String to_string_without_side_effects() const; + Value value_or(Value fallback) const { if (is_empty()) |