From d52130836ee35a061e2a6ab708b38f252e5c6cc1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 7 Mar 2020 21:43:10 +0100 Subject: [PATCH] LibJS: Simplify LogStream::operator<<(JS::Value) and move to .cpp file --- Libraries/LibJS/Value.cpp | 5 +++++ Libraries/LibJS/Value.h | 13 +------------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/Libraries/LibJS/Value.cpp b/Libraries/LibJS/Value.cpp index 6fdb149cdb6..54e3185dff9 100644 --- a/Libraries/LibJS/Value.cpp +++ b/Libraries/LibJS/Value.cpp @@ -53,4 +53,9 @@ String Value::to_string() const ASSERT_NOT_REACHED(); } +const LogStream& operator<<(const LogStream& stream, const Value& value) +{ + return stream << value.to_string(); +} + } diff --git a/Libraries/LibJS/Value.h b/Libraries/LibJS/Value.h index 2513f5d37cd..4a384e19dc1 100644 --- a/Libraries/LibJS/Value.h +++ b/Libraries/LibJS/Value.h @@ -123,17 +123,6 @@ inline Value js_null() return Value(Value::Type::Null); } -inline const LogStream& operator<<(const LogStream& stream, const Value& value) -{ - switch (value.type()) { - case Value::Type::Boolean: - return stream << value.as_bool(); - case Value::Type::Number: - return stream << (i32)value.as_double(); - default: - ASSERT_NOT_REACHED(); - return stream; - } -} +const LogStream& operator<<(const LogStream&, const Value&); }